|
@ -50,7 +50,7 @@ type AdminConfig struct { |
|
|
|
|
|
|
|
|
// The address to which the admin endpoint's listener should
|
|
|
// The address to which the admin endpoint's listener should
|
|
|
// bind itself. Can be any single network address that can be
|
|
|
// bind itself. Can be any single network address that can be
|
|
|
// parsed by Caddy.
|
|
|
// parsed by Caddy. Default: localhost:2019
|
|
|
Listen string `json:"listen,omitempty"` |
|
|
Listen string `json:"listen,omitempty"` |
|
|
|
|
|
|
|
|
// If true, CORS headers will be emitted, and requests to the
|
|
|
// If true, CORS headers will be emitted, and requests to the
|
|
@ -282,10 +282,12 @@ func (h adminHandler) serveHTTP(w http.ResponseWriter, r *http.Request) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if r.Method == http.MethodOptions { |
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PUT, PATCH, DELETE") |
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Cache-Control") |
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Credentials", "true") |
|
|
|
|
|
} |
|
|
w.Header().Set("Access-Control-Allow-Origin", origin) |
|
|
w.Header().Set("Access-Control-Allow-Origin", origin) |
|
|
w.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PUT, PATCH, DELETE") |
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Cache-Control") |
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Credentials", "true") |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// TODO: authentication & authorization, if configured
|
|
|
// TODO: authentication & authorization, if configured
|
|
|