From f80d6ebd15ee337437dae9246b89f7bce81d280f Mon Sep 17 00:00:00 2001 From: WeebDataHoarder <57538841+WeebDataHoarder@users.noreply.github.com> Date: Tue, 8 Apr 2025 13:13:19 +0200 Subject: [PATCH] Set X-Away-Id on response --- examples/forgejo.yml | 2 -- lib/http.go | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/forgejo.yml b/examples/forgejo.yml index 45997cc..3d0f415 100644 --- a/examples/forgejo.yml +++ b/examples/forgejo.yml @@ -116,8 +116,6 @@ challenges: # Challenges with a redirect via Link header with rel=preload and early hints (non-JS, requires HTTP parsing, fetching and logic) # Works on HTTP/2 and above! self-preload-link: - # doesn't seem to work reliably on other stuff that firefox - # userAgent.contains("Firefox/") && condition: '"Sec-Fetch-Mode" in headers && headers["Sec-Fetch-Mode"] == "navigate"' mode: "preload-link" runtime: diff --git a/lib/http.go b/lib/http.go index 44c123e..f2d4371 100644 --- a/lib/http.go +++ b/lib/http.go @@ -457,6 +457,11 @@ func (state *State) ServeHTTP(w http.ResponseWriter, r *http.Request) { } r.Header.Set("X-Away-Id", hex.EncodeToString(data.Id[:])) + w.Header().Set("X-Away-Id", hex.EncodeToString(data.Id[:])) + + // send these to client so we consistently get the headers + //w.Header().Set("Accept-CH", "Sec-CH-UA, Sec-CH-UA-Platform") + //w.Header().Set("Critical-CH", "Sec-CH-UA, Sec-CH-UA-Platform") r = r.WithContext(context.WithValue(r.Context(), "_goaway_data", &data))