mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 22:06:57 +00:00
Merge branch 'main' into refactor-take2
This commit is contained in:
commit
802e2feea7
1 changed files with 12 additions and 12 deletions
|
@ -54,7 +54,6 @@ func Handler(mainDomainSuffix, rawDomain []byte,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow CORS for specified domains
|
// Allow CORS for specified domains
|
||||||
if ctx.IsOptions() {
|
|
||||||
allowCors := false
|
allowCors := false
|
||||||
for _, allowedCorsDomain := range allowedCorsDomains {
|
for _, allowedCorsDomain := range allowedCorsDomains {
|
||||||
if bytes.Equal(trimmedHost, allowedCorsDomain) {
|
if bytes.Equal(trimmedHost, allowedCorsDomain) {
|
||||||
|
@ -67,6 +66,7 @@ func Handler(mainDomainSuffix, rawDomain []byte,
|
||||||
ctx.Response.Header.Set("Access-Control-Allow-Methods", "GET, HEAD")
|
ctx.Response.Header.Set("Access-Control-Allow-Methods", "GET, HEAD")
|
||||||
}
|
}
|
||||||
ctx.Response.Header.Set("Allow", "GET, HEAD, OPTIONS")
|
ctx.Response.Header.Set("Allow", "GET, HEAD, OPTIONS")
|
||||||
|
if ctx.IsOptions() {
|
||||||
ctx.Response.Header.SetStatusCode(fasthttp.StatusNoContent)
|
ctx.Response.Header.SetStatusCode(fasthttp.StatusNoContent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue