vaadin / router

Small and powerful client-side router for Web Components. Framework-agnostic.
https://vaadin.com/router
Apache License 2.0
413 stars 51 forks source link

Shareable urls/deep links #672

Open antonioaltamura opened 3 years ago

antonioaltamura commented 3 years ago

Hello, I'm trying to integrade vaadin router in a lit-element project. I realised if you refresh any page other than the home page, like /users/kim you are going to get a 404. That is obviously because the webserver (whatever it is) looks for the physical file /users/kim. What is the preferred way to workaround this? A redirect to index.html by default is not optimal, because you will get index.html even if you try to visit a wrong url like /fake_url_that_actually_should_return_404.

ko1ebayev commented 2 years ago

Hello! Facing the same issue, my router version is 1.7.4. Up!

inqb commented 1 year ago

Assuming you're using Snowpack: you need to define SPA Fallback Paths

djarekg commented 1 year ago

I too have a similar issue. I have a lit project as well and I am getting a similar issue only on child routes.

/home WORKS /customers WORKS /customers/14 NOT WORK

When I refresh the page I do not get a 404 on the page, but styles listed using relative paths in the index.html get a 404 bc the base url i believe changes on a refresh when on a child route.

Instead of using http://localhost:8000 as the base url, when refreshing the page on a child route the base url becomes http://localhost:8000/customers, If I was on the child route /customers/14 for example.

This is what the url is on refresh for one of the stylesheets...

http://localhost:8000/employees/node_modules/@rask/web/src/css/baseline.css