Can't have periods '.' in dynamic routes in prod because they break sirv
Opened this issue · 0 comments
Describe the bug
We have periods (like... /data/v1.2.3/foo) that work in dev mode, but break in production mode. It looks like this is due to sirv treating them like not found assets and having a different code path.
To Reproduce
- Make a dynamic route ('/data/[version]/[prop]')
- run with --env prod
- navigate to that route with a value with a period in it ('curl http://localhost:3000/data/v1.2.3/foo')
- the 404.html fallback page is not loaded. just an empty 404 response directly from sirv.
- Code/Link to Repo:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Specifics (please complete the following information):
- Python Version: 3.12
- Reflex Version: 0.8.11
- OS: Linux
- Browser (Optional):
Additional context
Add any other context about the problem here.
lukeed/sirv#132 describes the upstream bug that impacts reflex.
and sirv's documentation reads:
Any asset requests (URLs that end with an extension) ignore --single behavior and will send a 404 response instead of the "index.html" fallback. To ignore additional paths, pass URL patterns to the --ignores argument.
Don't include "/blog*" or "/portfolio*" pages into SPA
$ sirv public --single --ignores "^/blog" --ignores "^/portfolio"
You may pass a string to customize which file should be sent as fallback.
In other words, --single shell.html will send the directory's shell.html file instead of its index.html file.
so it seems quite clear that this does not work in sirv.