Skip to content

Commit e64789e

Browse files
authored
Fix CORS issues. (#14)
Fixes #13.
1 parent ec37ab4 commit e64789e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ func run() error {
6262
})
6363
r.PathPrefix("/").Handler(http.FileServer(http.FS(ui.FS)))
6464
corsObj := handlers.AllowedOrigins([]string{*cors})
65+
corsMethods := handlers.AllowedMethods([]string{"GET", "POST", "PUT", "DELETE", "OPTIONS"})
66+
corsHeaders := handlers.AllowedHeaders([]string{"Content-Type", "Authorization"})
6567

66-
return http.ListenAndServe(*bind, handlers.CORS(corsObj)(r))
68+
return http.ListenAndServe(*bind, handlers.CORS(corsObj, corsMethods, corsHeaders)(r))
6769
}
6870

6971
func getGatewayHandler(ctx context.Context) (http.Handler, error) {

0 commit comments

Comments
 (0)