forked from TrueCloudLab/frostfs-s3-gw
[#217] Add headers in response to simple requests
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
7d0bc1e992
commit
f4afe41086
1 changed files with 2 additions and 0 deletions
|
@ -162,6 +162,7 @@ func (h *handler) AppendCORSHeaders(w http.ResponseWriter, r *http.Request) {
|
||||||
for _, m := range rule.AllowedMethods {
|
for _, m := range rule.AllowedMethods {
|
||||||
if m == r.Method {
|
if m == r.Method {
|
||||||
w.Header().Set(api.AccessControlAllowOrigin, origin)
|
w.Header().Set(api.AccessControlAllowOrigin, origin)
|
||||||
|
w.Header().Set(api.AccessControlAllowMethods, strings.Join(rule.AllowedMethods, ", "))
|
||||||
w.Header().Set(api.AccessControlAllowCredentials, "true")
|
w.Header().Set(api.AccessControlAllowCredentials, "true")
|
||||||
w.Header().Set(api.Vary, api.Origin)
|
w.Header().Set(api.Vary, api.Origin)
|
||||||
return
|
return
|
||||||
|
@ -178,6 +179,7 @@ func (h *handler) AppendCORSHeaders(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
w.Header().Set(api.AccessControlAllowOrigin, o)
|
w.Header().Set(api.AccessControlAllowOrigin, o)
|
||||||
}
|
}
|
||||||
|
w.Header().Set(api.AccessControlAllowMethods, strings.Join(rule.AllowedMethods, ", "))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue