[DOC] Best approach to run a single page application with client-side routing? #2062
Unanswered
spwoodcock
asked this question in
Help
Replies: 1 comment
-
Hi @TheophileDiot, was the 'Help Wanted' label added because you would accept a PR for this, or you need more input from others? This issue is a big dealbreaker for using an SPA behind bunkerweb IMO. I'm having an absolute nightmare trying to register service workers when not accessing from the root domain, meaning my PWA is broken currently 😢 Note The change would mean that the server attempts to load It might be best to have multisite env vars as a flag:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Awesome project 🎉
SERVE_FILES
.Example config:
Proposed solution (optional)
Option 1: Modify serve-files.conf
The serve-files.conf file is as such:
bunkerweb/src/common/core/misc/confs/server-http/serve-files.conf
Lines 1 to 6 in 00e7529
try_files $uri $uri/ =404
-->try_files $uri $uri/ /index.html =404
Option 2: Override the 404
In the config above, it should be possible to add environment variable:
This would override the 404 response and point it to
index.html
, so that the SPA can handle the client-side routing.I'm interested to hear if others have encountered this, or if there is an approach I have not considered that would be preferred 🙏
Beta Was this translation helpful? Give feedback.
All reactions