]> source.dussan.org Git - gitea.git/commitdiff
Fix incorrect CORS default values (#24206) (#24217)
authorGiteabot <teabot@gitea.io>
Wed, 19 Apr 2023 20:23:25 +0000 (16:23 -0400)
committerGitHub <noreply@github.com>
Wed, 19 Apr 2023 20:23:25 +0000 (16:23 -0400)
Backport #24206 by @wxiaoguang

Document:

```
;ALLOW_DOMAIN = *
;METHODS = GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS
```

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
modules/setting/cors.go

index 260848b5df33c65903b0d63d5df311bde027945f..bafbbab64f990078c15ff8e955528c9d847849f7 100644 (file)
@@ -21,9 +21,10 @@ var CORSConfig = struct {
        Headers          []string
        XFrameOptions    string
 }{
-       Enabled:       false,
-       MaxAge:        10 * time.Minute,
+       AllowDomain:   []string{"*"},
+       Methods:       []string{"GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
        Headers:       []string{"Content-Type", "User-Agent"},
+       MaxAge:        10 * time.Minute,
        XFrameOptions: "SAMEORIGIN",
 }