API: Allow Basic authorization header

This commit is contained in:
Tomas Peterka 2022-09-19 12:14:28 +02:00 committed by Frédéric Guillot
parent 556d88c96d
commit 70c58bd346

View file

@ -25,7 +25,7 @@ func (m *middleware) handleCORS(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS") w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "X-Auth-Token") w.Header().Set("Access-Control-Allow-Headers", "X-Auth-Token, Authorization")
if r.Method == http.MethodOptions { if r.Method == http.MethodOptions {
w.Header().Set("Access-Control-Max-Age", "3600") w.Header().Set("Access-Control-Max-Age", "3600")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)