/*
-tofuproxy -- flexible HTTP proxy, TLS terminator, X.509 certificates
- manager, WARC/Gemini browser
+tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
+ manager, WARC/geminispace browser
Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
}
paths := strings.Split(strings.TrimPrefix(req.URL.Path, "/"), "/")
host, paths = paths[0], paths[1:]
+ if host == "gemini:" {
+ http.Redirect(w, req, strings.Join(
+ append([]string{GeminiEntrypoint}, paths[1:]...), "/",
+ ), http.StatusTemporaryRedirect)
+ return false, nil
+ }
hostWithPort := host
if !strings.Contains(hostWithPort, ":") {
hostWithPort += GeminiPort