aboutsummaryrefslogtreecommitdiff
path: root/cmd/anubis
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2025-01-19 00:53:02 -0500
committerXe Iaso <me@xeiaso.net>2025-01-19 00:53:02 -0500
commit1897175f38ef99d3c06f5e810d371fea53228545 (patch)
treebb4fc912ac3b4e21cde07b8a219f5bda0dec8bf1 /cmd/anubis
parent1b8d1729e0a2b4eb38a897c0b70d646c95424606 (diff)
downloadx-1897175f38ef99d3c06f5e810d371fea53228545.tar.xz
x-1897175f38ef99d3c06f5e810d371fea53228545.zip
cmd/anubis: clear the cookie more robustly
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd/anubis')
-rw-r--r--cmd/anubis/main.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/anubis/main.go b/cmd/anubis/main.go
index b9b907f..cd1a1a6 100644
--- a/cmd/anubis/main.go
+++ b/cmd/anubis/main.go
@@ -202,6 +202,12 @@ func (s *Server) maybeReverseProxy(w http.ResponseWriter, r *http.Request) {
return
}
+ if ckie.Expires.IsZero() {
+ slog.Debug("cookie has no expiration time", "path", r.URL.Path)
+ s.renderIndex(w, r)
+ return
+ }
+
slog.Debug("cookie expiration time", "expires", ckie.Expires)
if !ckie.Expires.IsZero() && ckie.Expires.Before(time.Now()) {
slog.Debug("cookie expired", "path", r.URL.Path)
@@ -395,6 +401,7 @@ func clearCookie(w http.ResponseWriter) {
Name: cookieName,
Value: "",
Expires: time.Now().Add(-1 * time.Hour),
+ MaxAge: -1,
})
}