diff options
author | Alan Pearce | 2024-12-04 19:56:41 +0100 |
---|---|---|
committer | Alan Pearce | 2024-12-04 19:56:41 +0100 |
commit | 60dbf7194e15c8ffafb530769611396ac361640e (patch) | |
tree | 08b6dcd3f2ebd927550a5a358802c5f8e801cbd9 /internal/server/tls.go | |
parent | 996233fb862a6686ae719c91898edc68b5e792a5 (diff) | |
download | website-60dbf7194e15c8ffafb530769611396ac361640e.tar.lz website-60dbf7194e15c8ffafb530769611396ac361640e.tar.zst website-60dbf7194e15c8ffafb530769611396ac361640e.zip |
tls: only redirect to HTTPS if host is known
Diffstat (limited to 'internal/server/tls.go')
-rw-r--r-- | internal/server/tls.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/server/tls.go b/internal/server/tls.go index 56c2215..183ce70 100644 --- a/internal/server/tls.go +++ b/internal/server/tls.go @@ -131,7 +131,11 @@ func (s *Server) serveTLS() (err error) { } url.Host = net.JoinHostPort(host, s.config.BaseURL.Port()) } - http.Redirect(w, r, url.String(), http.StatusMovedPermanently) + if slices.Contains(s.config.Domains, r.Host) { + http.Redirect(w, r, url.String(), http.StatusMovedPermanently) + } else { + http.NotFound(w, r) + } }) srv.Handler = httpMux |