New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trailing / at the end of the url going to error page #127
Comments
It seems a problem caused by Any pathname with trailing |
Trailing / could be auto stripped Line 64 in 7f931ca
|
@jplhomer i'm an amateur, so be gentle if this is wrong... this is also my first contribution? to an open source project... In tracing the code, it looks like the bad assumption is definitely in kv-asset-handler as mentioned by @arctome , but the fix is elsewhere. Moreover, I don't think the fix is in worker.js, as that really only fires if the page is not found... we need to make the page get found, so that kv-asset-handler never sees the request. In order to do this, we need to update worker/index.js 's handleRequest function to strip trailing bad characters thus making the call succeed so that the fallback function is never called. Since I'm such an amateur, I don't know how to do that, so I patched the input to that function in my root /index.js. The way I did it was to add a utlity function that strips slashes, which I used against the event<.request.url>, which I then passed to handleEvent as before. It works with any number of trailing slashes on root and dynamic routes. There may be cases that don't work... and there may be other characters that should be stripped... The regex can be updated to deal with any other bad actors in the url. here's my gist. |
Would need a similar fix for the API routes. |
Just ran into this. Intermittent. If I go to the URL with no slash, then back to the URL with a slash... it'll load fine. But initial load with |
Describe the problem:
The slash at the end not auto resolving.
For example
https://cool-bio-flareact-styled.coolbio.workers.dev/subh/ will throw an error
but https://cool-bio-flareact-styled.coolbio.workers.dev/subh is accessible.
Link to a minimal reproduction:
https://github.com/subhendukundu/cool-bio-flareact-styled
The text was updated successfully, but these errors were encountered: