mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 14:26:58 +00:00
[std-http] fix-header (#134)
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/134
This commit is contained in:
parent
4117775cf0
commit
7526873049
9 changed files with 72 additions and 75 deletions
|
@ -80,7 +80,7 @@ func Handler(mainDomainSuffix, rawDomain string,
|
|||
|
||||
ctx.RespWriter.Header().Set("Allow", http.MethodGet+", "+http.MethodHead+", "+http.MethodOptions) // duplic 1
|
||||
if ctx.IsMethod(http.MethodOptions) {
|
||||
ctx.Response().StatusCode = http.StatusNoContent
|
||||
ctx.RespWriter.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,8 @@ func Handler(mainDomainSuffix, rawDomain string,
|
|||
|
||||
if canonicalLink != "" {
|
||||
// Hide from search machines & add canonical link
|
||||
ctx.Response().Header.Set("X-Robots-Tag", "noarchive, noindex")
|
||||
ctx.Response().Header.Set("Link",
|
||||
ctx.RespWriter.Header().Set("X-Robots-Tag", "noarchive, noindex")
|
||||
ctx.RespWriter.Header().Set("Link",
|
||||
strings.NewReplacer("%b", targetBranch, "%p", targetPath).Replace(canonicalLink)+
|
||||
"; rel=\"canonical\"",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue