mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-06-10 13:30:49 +00:00
Match on the full request URL when applying headers.
Fixes: https://codeberg.org/git-pages/git-pages/issues/206
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ func configureFeatures(ctx context.Context) (err error) {
|
||||
for _, feature := range config.Features {
|
||||
switch feature {
|
||||
// Work-in-progress features:
|
||||
case "preview", "expiration":
|
||||
case "preview", "expiration", "absolute-headers":
|
||||
// Permanently unstable features:
|
||||
case "codeberg-pages-compat", "relaxed-idna":
|
||||
// Stabilized features:
|
||||
|
||||
+5
-1
@@ -446,7 +446,11 @@ func getPage(w http.ResponseWriter, r *http.Request) error {
|
||||
w.Header().Set("Content-Type", *entry.ContentType)
|
||||
}
|
||||
|
||||
customHeaders, err := ApplyHeaderRules(manifest, &url.URL{Path: entryPath})
|
||||
headersMatchURL := &url.URL{Path: entryPath}
|
||||
if config.Feature("absolute-headers") {
|
||||
headersMatchURL = (&url.URL{Host: r.Host}).ResolveReference(r.URL)
|
||||
}
|
||||
customHeaders, err := ApplyHeaderRules(manifest, headersMatchURL)
|
||||
if err != nil {
|
||||
// This is an "internal server error" from an HTTP point of view, but also
|
||||
// either an issue with the site or a misconfiguration from our point of view.
|
||||
|
||||
Reference in New Issue
Block a user