limit cors only get, head, options

This commit is contained in:
codeskyblue
2023-12-19 10:37:39 +08:00
parent 80c9e79869
commit ea7272437d
4 changed files with 4 additions and 2 deletions

1
.gitignore vendored
View File

@@ -31,3 +31,4 @@ assets_vfsdata.go
*.swp *.swp
dist/ dist/
.DS_Store

View File

@@ -33,7 +33,7 @@ Tested with go-1.16
1. [x] Apple ipa auto generate .plist file, qrcode can be recognized by iphone (Require https) 1. [x] Apple ipa auto generate .plist file, qrcode can be recognized by iphone (Require https)
1. [x] Plist proxy 1. [x] Plist proxy
1. [ ] Download count statistics 1. [ ] Download count statistics
1. [x] CORS enabled 1. [x] CORS enabled (AllowMethods: GET, HEAD, OPTIONS)
1. [ ] Offline download 1. [ ] Offline download
1. [ ] Code file preview 1. [ ] Code file preview
1. [ ] Edit file support 1. [ ] Edit file support

View File

@@ -207,7 +207,7 @@ func main() {
// CORS // CORS
if gcfg.Cors { if gcfg.Cors {
hdlr = handlers.CORS()(hdlr) hdlr = handlers.CORS(handlers.AllowedMethods([]string{"GET", "HEAD", "OPTIONS"}))(hdlr)
} }
if gcfg.XHeaders { if gcfg.XHeaders {
hdlr = handlers.ProxyHeaders(hdlr) hdlr = handlers.ProxyHeaders(hdlr)

1
testdata/filetypes/script.js vendored Normal file
View File

@@ -0,0 +1 @@
document.write("Hello world!")