-
Notifications
You must be signed in to change notification settings - Fork 267
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
feat: allow more control over the different base URLs #717
Conversation
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
@allan2 @colons @hmacias-avaya here's a proposal for dealing with this. It would be great if any of you could take a look if this solves your problems. |
I just tried it; the public-url seems to help, at the cost of having the user specify this. My scenario:
I ran trunk using When I send this request and see what index.html contains, I can see /my_app/ prepended everywhere which makes the browser requests for all the other resources (wasm, js, etc) succeed. For example <link rel="preload" href="/my-app/application.wasm" ... > So, so far, so good. If I send a request to some other subpath, for example http://host/something/index.html I see trunk still sends OK with the same content with all resources pointing to Perhaps this is not a valid scenario (I used If trunk was using paths relative to the resource requested, trunk itself wouldn't care about the public url when serving. trunk could return the same content using relative paths: <link rel="preload" href="./application.wasm" ... > and this would mean the user needs to specify one less argument over the cli. Trunk is completely unaware of what the reverse proxy is doing and doesn't need to know any of the request manipulations that happen before it (as long as relative urls are used). Again I'm likely missing something else but if there is a way to achieve the same with less configuration options I'd go for that. |
...if I run with <link rel="preload" href="./application.wasm" ... > which makes this work regardless of the subpath used, which is good (and why I think So, all in all, the |
Thanks for testing! And I think you just proved that what I had in my mind worked:
I would rephrase this as: The user has the ability now to specify this
That may be the case for you, but not necessarily for everyone else. Using So unless we find a good way to deal with this, not only with |
Thanks for this! My use case (basically a SPA, that can be hosted at random paths) now works with the |
Testing, but you done that 😄 I'll also keep testing a bit longer. Maybe I can do a proper release next week. |
also curious what we can do to help getting a full release? |
Testing :) There's one more thing I would like to sort out. Which is prefixing (e.g. the wasm) with a sub-directory in the dist folder. That change has landed, but needs some fixing for Windows and some corner cases. |
No description provided.