diff options
author | Girish Sonawane <girish.sonawane@gmail.com> | 2017-03-11 13:31:59 +0530 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2017-03-11 03:01:59 -0500 |
commit | b9bb4a62d60c0e8b863f160e5f35e67b94c18e6c (patch) | |
tree | dd765c2d51c5450e3157049c7b350ff886a24e12 /modules | |
parent | 61e2bff757516d26772c78259961d8fefeae4bdb (diff) |
api: make CORS work by handling preflight OPTIONS request (#4264)
* make CORS work by handling preflight OPTIONS request
* Update api.go
Diffstat (limited to 'modules')
-rw-r--r-- | modules/context/context.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index e3cc6f6b..31378532 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -159,6 +159,9 @@ func Contexter() macaron.Handler { if len(setting.HTTP.AccessControlAllowOrigin) > 0 { ctx.Header().Set("Access-Control-Allow-Origin", setting.HTTP.AccessControlAllowOrigin) + ctx.Header().Set("'Access-Control-Allow-Credentials' ", "true") + ctx.Header().Set("Access-Control-Max-Age", "3600") + ctx.Header().Set("Access-Control-Allow-Headers", "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With") } // Compute current URL for real-time change language. |