In release build I can refresh
glennpierce opened this issue · comments
Hi
I have a rust leptos site that when using development trunk serve seems to work fine.
I can navigate to other pages etc. When refreshing the page with the browser button or using the url the page reloads as you would expect.
When doing a trunk build --release
The site loads ok and I can navigate to a different page but when do a reload or hitting enter on the url I get a Not Found error.
My apache is set up just to serve dist directory ie
Alias /dist /opt/redwood/dist
<Directory /opt/redwood/dist>
Require all granted
Options +Indexes
AllowOverride None
Order allow,deny
Allow from all
What could be the issue here. I am probably doing something silly.
That's a common problem of "single page applications". The URL in the browser's location bar is only changed visually. But it never requests that page. Until to trigger some kind of a reload.
Trunk know about this and by default (expect when using the --no-spa
flag) returns the main resources instead of a 404, which does the trick.
With nginx
you can do the same using:
http {
server {
listen 8080;
server_name _;
root /public;
absolute_redirect off;
error_page 404 =200 /index.html;
location / {
index index.html;
}
}
types {
application/wasm wasm;
}
}
I have no idea about Apache, sorry.