gonic icon indicating copy to clipboard operation
gonic copied to clipboard

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

Open 991jo opened this issue 1 year ago • 1 comments

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 avatar Oct 14 '24 21:10 991jo

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.

991jo avatar Oct 15 '24 04:10 991jo

Thank you very much for fixing this. Will there be a release soon or do I have to roll the latest commit on my setup to test the fix?

991jo avatar Jan 15 '25 22:01 991jo

hey, not sure when the next release will be but for the meantime i'd recommend building from master

sentriz avatar Jan 15 '25 22:01 sentriz