aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdnan Maolood <me@adnano.co>2021-02-24 17:50:31 -0500
committerDrew DeVault <sir@cmpwn.com>2021-02-25 08:51:38 -0500
commit6d23d00a6fdb52df29218265a321d44c950cf513 (patch)
treea637a7e85b0552c944299af94ab1d64aa1075d5c
parentAdd support for custom CSS. (diff)
downloadkineto-6d23d00a6fdb52df29218265a321d44c950cf513.tar.bz2
kineto-6d23d00a6fdb52df29218265a321d44c950cf513.zip
Fix relative redirects
Setting next.Host before setting next.Path breaks relative redirects on external sites, where next.Host != r.URL.Host.
-rw-r--r--main.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.go b/main.go
index f13605e..bbfac30 100644
--- a/main.go
+++ b/main.go
@@ -426,10 +426,10 @@ func proxyGemini(req gemini.Request, external bool, root *url.URL,
w.Write([]byte(fmt.Sprintf("This page is redirecting you to %s", next.String())))
return
}
- next.Host = r.URL.Host
if external {
next.Path = fmt.Sprintf("/x/%s/%s", next.Host, next.Path)
}
+ next.Host = r.URL.Host
next.Scheme = r.URL.Scheme
w.Header().Add("Location", next.String())
w.WriteHeader(http.StatusFound)