summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index 54ce6f4..e39a001 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -1069,6 +1069,15 @@ func (h *authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.h.ServeHTTP(w, r)
}
+type loggingHandler struct {
+ h http.Handler
+}
+
+func (h *loggingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+ log.Printf("%q from %q", r.Method+" "+r.URL.String(), r.RemoteAddr)
+ h.h.ServeHTTP(w, r)
+}
+
func main() {
flag.Parse()
@@ -1144,12 +1153,13 @@ func main() {
apiMux.HandleFunc("PUT /api/wormhole/{name}", wormholeAPIUpload)
mux.Handle("/api/", apiMux)
mux.HandleFunc("/", notFound)
- http.Handle(selfURL.Hostname()+"/", http.NewCrossOriginProtection().Handler(&gzipHandler{mux}))
+ serverMux := http.NewServeMux()
+ serverMux.Handle(selfURL.Hostname()+"/", http.NewCrossOriginProtection().Handler(&gzipHandler{mux}))
jellyfinURL, err := url.Parse("http://127.0.0.1:8096")
if err != nil {
log.Fatal(err)
}
- http.Handle("cinema."+selfURL.Hostname()+"/", &authHandler{h: &httputil.ReverseProxy{
+ serverMux.Handle("cinema."+selfURL.Hostname()+"/", &authHandler{h: &httputil.ReverseProxy{
Rewrite: func(r *httputil.ProxyRequest) {
r.SetURL(jellyfinURL)
r.SetXForwarded()
@@ -1171,7 +1181,8 @@ func main() {
}
cgitCGI.PathLocationHandler = cgitCGI
codeMux.Handle("/", cgitCGI)
- http.Handle("code."+selfURL.Hostname()+"/", &gzipHandler{codeMux})
+ serverMux.Handle("code."+selfURL.Hostname()+"/", &gzipHandler{codeMux})
+ http.Handle("/", &loggingHandler{serverMux})
port := selfURL.Port()
if port == "" {