mirror of
https://github.com/axllent/mailpit.git
synced 2026-06-28 06:56:06 +00:00
Feature: Add Access-Control-Allow-Methods methods when CORS origin is set
@See #91
This commit is contained in:
@@ -122,6 +122,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")
|
||||
}
|
||||
|
||||
if config.UIAuthFile != "" {
|
||||
@@ -159,6 +160,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")
|
||||
}
|
||||
|
||||
if config.UIAuthFile != "" {
|
||||
|
||||
Reference in New Issue
Block a user