cockpit-project / cockpit

Cockpit is a web-based graphical interface for servers.
http://www.cockpit-project.org/
GNU Lesser General Public License v2.1
11.14k stars 1.1k forks source link

On reverse proxy with an UrlRoot= the error page fails to load its fonts #17443

Open jelly opened 2 years ago

jelly commented 2 years ago

Explain what happens

Similar to this commit 62c45a95c91dc1ecfbc235a248cb30aa68d262a3 these fonts should be loaded with a relative path but not absolute.

src/common/fail.html:            src: url('/cockpit/static/fonts/RedHatDisplay-Medium.woff2') format('woff');
src/common/fail.html:            src: url('/cockpit/static/fonts/OpenSans-Light-webfont.woff') format('woff');

The question is how / where the C code in src/common/fail.html.c loads the error page.

More details: https://gist.github.com/jelly/331f26e1c7ee4580627fdd164565d74a

Version of Cockpit

270

Where is the problem in Cockpit?

No response

Server operating system

No response

Server operating system version

No response

What browsers are you using?

No response

System log

No response

jelly commented 2 years ago

The tricky part here is that removing the prefix and making it absolute works for the login page, but not when you for example browser to https://cockpit.lan/system/services/notfound as that would resolve to `https://cockpit.lan/system/services/notfound/fonts/foo.woff

jelly commented 2 years ago

In theory we could make the fail.html respect UrlRoot by getting the value in cockpit-ws and setting it as a template string in cockpit_web_response_error but this is a bit tricky to do.