mirror of
https://github.com/axllent/mailpit.git
synced 2025-01-24 03:47:38 +02:00
API: Set Access-Control-Allow-Headers when --api-cors is set
This commit is contained in:
parent
14a61859f0
commit
16bc025fff
@ -123,6 +123,7 @@ func middleWareFunc(fn http.HandlerFunc) http.HandlerFunc {
|
||||
if AccessControlAllowOrigin != "" && strings.HasPrefix(r.RequestURI, config.Webroot+"api/") {
|
||||
w.Header().Set("Access-Control-Allow-Origin", AccessControlAllowOrigin)
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "*")
|
||||
}
|
||||
|
||||
if config.UIAuthFile != "" {
|
||||
@ -161,6 +162,7 @@ func middlewareHandler(h http.Handler) http.Handler {
|
||||
if AccessControlAllowOrigin != "" && strings.HasPrefix(r.RequestURI, config.Webroot+"api/") {
|
||||
w.Header().Set("Access-Control-Allow-Origin", AccessControlAllowOrigin)
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "*")
|
||||
}
|
||||
|
||||
if config.UIAuthFile != "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user