Able to set custom Access-Control-Allow-Origin header (#3987)

Added new config option '[http] ACCESS_CONTROL_ALLOW_ORIGIN'.
This commit is contained in:
Unknwon
2017-01-28 19:59:17 -05:00
parent c98aa0e895
commit 5e01ecbc05
7 changed files with 57 additions and 42 deletions

View File

@@ -156,6 +156,11 @@ func Contexter() macaron.Handler {
},
Org: &Organization{},
}
if len(setting.HTTP.AccessControlAllowOrigin) > 0 {
ctx.Header().Set("Access-Control-Allow-Origin", setting.HTTP.AccessControlAllowOrigin)
}
// Compute current URL for real-time change language.
ctx.Data["Link"] = setting.AppSubUrl + strings.TrimSuffix(ctx.Req.URL.Path, "/")