-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using X-Forwarded-Prefix to Support Reverse Proxy #459
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the request and can confirm that this is exactly the solution that is running productively in most of our projects.
@rodja I'll add my thoughts here so it's easier to follow 😃 From what I understand, we'll rely here on the We also need to manually build the WebSocket URL, and the complexity of the logic involved in this (having to handle the port, the path prefix, etc.) looks to me like a smell that something isn't quite right. Personnally, I prefer the |
Maybe there is still something wrong. In NiceGUI we experience this bug: zauberzeug/nicegui#64. Maybe some paths are not yet using relative addresses. |
@rodja Dropping my two cents here about zauberzeug/nicegui#64. It's probably because those are fonts file that are defined in hard in the CSS files. Like here: I'm not really sure how to solve this properly, apart from loading those fonts from a CDN. |
The
The WebSocket URL is already build manually (see https://github.com/elimintz/justpy/blob/72f94a9f1e7fcd2734b3c947ba2e830387083698/justpy/templates/main.html#L75-L79). But of course using the right path adds to the complexity.
As I wrote in #451 (comment), the |
In 0b30fd3 I also fixed the font issue. Thanks @frankie567 for pointing out the problem in #459 (comment) |
@frankie567 pointed out that using
What do you think? |
Tried to merge this but it breaks the CI |
I reverted back to v0.3.0 tag. Please restart your pull request making sure it doesn't break the tests. |
There have been several attempts and multiple discussions (#402, #220) about hosting JustPy behind a reverse proxy like Nginx, Apache or Traefik:
url_for()
calls throughout the whole code baseThis pull request simply adds a
<base>
tag in the html header which uses the http header fieldX-Forwarded-Prefix
to set the correct url prefix. This header field is normally set by reverse proxies for exactly this purpose.#fixes #220