Skip to content

Commit b2d26f4

Browse files
author
Hexawolf
committed
Set allowed headers in CORS
A web-server must enlist all allowed headers from client in order to work properly. Uuhhh.
1 parent 67f8083 commit b2d26f4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
359359
s.serveFile(w, r)
360360
} else if r.Method == http.MethodOptions {
361361
w.Header().Set("Access-Control-Allow-Methods", "HEAD, GET, POST, DELETE")
362+
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length")
362363
w.WriteHeader(http.StatusNoContent)
363364
} else {
364365
w.WriteHeader(http.StatusMethodNotAllowed)

0 commit comments

Comments
 (0)