diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2026-09-02 20:18:03 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2026-09-02 20:19:04 -0700 |
| commit | 303ed1618f0efa1ec99ce7259f257fee6cf602a0 (patch) | |
| tree | 7ab212b4f261929a64dc9e45f5560e1f780c44e7 | |
| parent | bd15520f8440efbec48264936e43790a4f1d325b (diff) | |
| download | roseh.moe-303ed1618f0efa1ec99ce7259f257fee6cf602a0.tar.zst | |
Fix internal redirects
| -rw-r--r-- | roseh.moe.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/roseh.moe.go b/roseh.moe.go index b1cf181..5bc02d8 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -1099,17 +1099,19 @@ func main() { r.SetXForwarded() }, }}) + cgitMux := http.NewServeMux() cgitStaticFiles := http.FileServer(http.Dir(*cgit)) - http.Handle("code."+*domain+"/cgit.css", cgitStaticFiles) - http.Handle("code."+*domain+"/cgit.js", cgitStaticFiles) - http.Handle("code."+*domain+"/cgit.png", cgitStaticFiles) - http.Handle("code."+*domain+"/favicon.ico", cgitStaticFiles) - http.Handle("code."+*domain+"/robots.txt", cgitStaticFiles) - http.Handle("code."+*domain+"/", &cgi.Handler{ + cgitMux.Handle("/cgit.css", cgitStaticFiles) + cgitMux.Handle("/cgit.js", cgitStaticFiles) + cgitMux.Handle("/cgit.png", cgitStaticFiles) + cgitMux.Handle("/favicon.ico", cgitStaticFiles) + cgitMux.Handle("/robots.txt", cgitStaticFiles) + cgitMux.Handle("/", &cgi.Handler{ Path: filepath.Join(*cgit, "cgit.cgi"), Env: []string{"CGIT_CONFIG=" + *cgitConfig}, - PathLocationHandler: http.DefaultServeMux, + PathLocationHandler: cgitMux, }) + http.Handle("code."+*domain+"/", cgitMux) addr := fmt.Sprintf(":%d", *port) log.Printf("Listening on %q", addr) |
