router icon indicating copy to clipboard operation
router copied to clipboard

Shareable urls/deep links

Open antonioaltamura opened this issue 4 years ago • 3 comments

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.

antonioaltamura avatar Aug 25 '21 12:08 antonioaltamura

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

ko1ebayev avatar Aug 02 '22 16:08 ko1ebayev

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

inqb avatar Feb 23 '23 13:02 inqb

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

djarekg avatar Apr 27 '23 18:04 djarekg