-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feature request: Configurable WebSocket location #626
Comments
I have a slightly related issue. I'm commenting here as I do think this is related and may help solve the issue without having to add an additional configuration option (if you prefer me to open another issue just let me know). Shouldn't the Currently trunk/autoreload is looking at the browser address and adding For example, I'm serving an application behind a reverse proxy. I can tinker with the reverse proxy configuration but ideally this should be transparent. Whichever path the browser used to reach index.html should be used again for reaching |
Having that nested somewhere in a lower path might actually make things a bit more complicated. As stuff might overlap now with other paths (like proxied stuff). |
Perhaps I'm missing the bigger picture, sorry. I may be mixing things again but I do believe are related. The point I was trying to make is (and I believe this is also related to how other resources are loaded using a non "./" relative url such as #668) is the following: If the html produced/served by trunk is using For example:
If, on the other hand, the html produced/served by trunk uses In this scenario, trunk will still receive a request to
...of course, if there is another way to achieve this "reverse proxy scenario" which also makes the reloading ws work, please let me know :) |
in case this is of any help, I forked from 0.18.7 and made some changes to how autoreload and the rust resources are loaded, and this seems to work for me (where trunk is behind a reverse proxy) without needing to configure websocket location or doing anything else. For sure I have not gone through all the other resource types being bundled so that would need likely similar minor updates as well. |
So if you have something that works, I think it would be great to have a PR so that we can take a look at this. I am pretty sure putting a reverse proxy in front of trunk was ever considered. Still, if we could add this for 0.19.x it might be a valuable addition. I guess having a |
thanks, I've just created #714, let's see if that makes sense. |
This change introduced the idea of the three different base URLs: * The public base/common prefix, when generating links * The "serve base", when serving content using `trunk serve` * The "websocket base", where the auto-reload websocket connects to The sane default still is to use an absolute --public-url, defaulting to `/`. However, each of the URLs/bases can be overridden when necessary. Closes: trunk-rs#668, trunk-rs#626
This change introduced the idea of the three different base URLs: * The public base/common prefix, when generating links * The "serve base", when serving content using `trunk serve` * The "websocket base", where the auto-reload websocket connects to The sane default still is to use an absolute --public-url, defaulting to `/`. However, each of the URLs/bases can be overridden when necessary. Closes: #668, #626
I think this should be addressed by |
Trunk 0.19.0 was released. |
Originally opened as ctron#10.
Opening here due to the recent changes breathing life into upstream Trunk ;)
I would like to use Nginx in front of Trunk when developing, but I am encountering some problems with autoreload.
Trunk serves on
[::1]:8080
. I would like to be able to use both of these configurations:subdomain setup (app.example.com)
[::1]:8080
. This may be the same as Trunk lib: Bundle & hash images/other resources referenced in Rust WASM source code #9non-root-path setup (example.com/app)
In this setup,
public_url
must be set in Trunk.toml for the SPA to load:The SPA must also be made aware of the pathname to route properly.
In this configuration, Trunk is looking for the WS socket in the wrong place at
https://example.com/_trunk/ws
. This affects both thedodd/trunk and ctron/trunk.It would be nice if the socket location also followed
public_url
or if it could be configured separately.(I filed this issue here instead of upstream because it seems more active)
Thank you!
The text was updated successfully, but these errors were encountered: