sentriz / gonic

music streaming server / free-software subsonic server API implementation
ircs://irc.libera.chat/#gonic
GNU General Public License v3.0
1.6k stars 112 forks source link

URL for fonts in CSS does not have the proxy-prefix #543

Open 991jo opened 6 days ago

991jo commented 6 days ago

gonic version: v0.16.4

I am running gonic behind a proxy with the proxy-prefix set to

proxy-prefix                /streaming/

My proxy is caddy with the following config

example.com {
        handle_path /streaming* {
                reverse_proxy http://localhost:4747
        }

        handle {
                reverse_proxy http://localhost:8080
        }
}

When I am accessing gonic in example.com/streaming/ then the CSS at https://example.com/streaming/admin/static/style.css?v=0.16.4 contains the fonts as shown in https://github.com/sentriz/gonic/blob/master/server/ctrladmin/adminui/style.css

Those URLs don't have the /streaming/ prefix and therefore are not handled by the correct handler and run into my general handler instead which can't serve them (and asks for basic auth instead, because that's what happens in that handler).

The fonts in the CSS should be prefixed with the correct proxy-prefix to load correctly with the proxy.

991jo commented 6 days ago

It also looks like the static fonts are not served under the proxy-prefix. They are served directly under /admin/static/inconsolata-v31-latin-600.woff2, however other static items get the prefix correctly, e.g. the header image is served from streaming/admin/static/gonic.png as it should.

I build a workaround with my proxy, extending the config a bit:

example.com {
        handle_path /streaming* {
                reverse_proxy http://localhost:4747
        }

        handle /admin* {
                reverse_proxy http://localhost:4747
        }

        handle {
                reverse_proxy http://localhost:8080
        }
}

However this now uses up the /admin path.