-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Routing doesn't work #1986
Comments
Hi 👋 So I've had a look at this and realised that the In terms of solutions you can follow the same tactic of creating a Otherwise another solution in mind is using the impl PublicUrlSwitch {
fn base_url() -> Url {
if cfg!(debug_assertions) {
Url::new("https://localhost:8000").unwrap()
} else {
Url::new("REMOTE_URL").unwrap()
}
}
// rest omitted for brevity Where "REMOTE_URL" is probably http://swaplink.xyz:3000 based on your issue. I'm not sure if this is the best/blessed solution to the problem but will hopefully get your web app working remotely 🙏 |
Hi @mc1098! Thanks very much for your response, unfortunately I was short of time and ended migrating the UI to React (also because of other issues, one of which we discussed). I'll keep an eye on Yew for future projects! Using Rust to build the UI is very convenient (can extra confirm after writing the JS glue for React). |
I have other problem with Route, Don't work, I hope the team can fix this |
Same for me. Also, it is very likely that v0.19.0 won't solve this problem. I'm already using the master branch and my router returns 404 errors on my deployed page. |
Helped this person in discord. |
@voidpumpkin That + the fact that you have to use |
Closing this since |
Problem
This site: https://github.com/ivanschuetz/swaplink
works correctly when ran locally (as per readme's instructions).
Routes:
When deploying to a remote server, the
/submit/{}
route doesn't work anymore:http://swaplink.xyz/submit/sdfs
Root still works:
http://swaplink.xyz
I was told to add this code: https://github.com/yewstack/yew/blob/0.18.0/examples/router/src/switch.rs#L21-L88
Which I did in this branch: ivnsch/swaplink#1
With the only effect that now locally the routing for
/submit/{}
also doesn't work (differently to the remote server here it shows "Route doesn't match" on the UI (or similar, don't remember the exact wording).I tried to debug the issue by copy pasting my code into the yew example, and it works there. Maybe it's related with the fact that I'm using wasm-pack (I need it because of an npm dependency)?
Environment:
I doubt that it's relevant, but just in case this is my nginx config:
where
/srv/sites/swaplink
contains the files generated in thedist
folder (as per readme).With another server, e.g:
it shows 404:
http://swaplink.xyz:3000/submit/sdsf
Root works:
http://swaplink.xyz:3000
Questionnaire
* I don't really have time but if it's a must to fix it quickly I can look into it, with some guidance.
The text was updated successfully, but these errors were encountered: