-
Notifications
You must be signed in to change notification settings - Fork 974
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
[Bug?]: fastify server not handling periods in query params #9663
Comments
Hi @ajluker and thanks for the issue write up. Could you help me understand the issue more by sharing an example repo that reproduces this (so we can quickly run and see in in action)?
If a repo isn't available, could you provide some steps to recreate from scratch, for example:
So we can be sure we are seeing the asme behavior you are |
I was able to reproduce using those basic steps above (with no septic fastify config, just oui of of) with However, url encoding the querystring params like Need to determine if Fastify expect urls to be encoded or not -- or if there is a setting to configure. |
@jtoar or @Josh-Walker-GM do you think that the not found handler is invoked because it thinks such a url with a period is an asset/extension (like a .png, .jpg etc)? And thus the not found? See:
|
According to path docs:
See: https://nodejs.org/api/path.html#pathextnamepath @ajluker Is there a specific reason you need have a period in the url that isn't URL encoded? Seems to think that when a period is in the url, it's an extension? |
Also @jtoar seems this new behavior was introduced in |
I can work around it by encoding for sure, but I shouldn't really have to, it's part of the spec to allow unencoded period characters in urlencoded search params: https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set |
@ajluker Agreed. I just found the PR that changed the behavior and assigned to @jtoar to explore. Please see: https://github.com/redwoodjs/redwood/pull/9272/files It was put into to help with serving static assets, but had some downstream effect. Thanks for reporting and now we have a way to reproduce and found the likely cause. |
Thanks for being responsive! |
Just adding to the reproduction steps here that this only works if the page isn't prerendered |
## What does this PR do? Fix for this issue. #9663 If the query parameter contains`. `will result in a 404 error when routing to the defined route. Example.) http://localhost:8910/posts?redirect_url=https%3A%2F%2Fwww.google.com ## The problem occurs - Version: 6.3.3 or higher - When the application is running with `yarn rw serve` command. ## The problem not occurs - Version: 6.3.2 or lower - When the application is running with `yarn rw dev` command. --------- Co-authored-by: yuichi.nishitani <hawkk9.public@gmail.com> Co-authored-by: Dominic Saadi <dominiceliassaadi@gmail.com>
Fix for this issue. #9663 If the query parameter contains`. `will result in a 404 error when routing to the defined route. Example.) http://localhost:8910/posts?redirect_url=https%3A%2F%2Fwww.google.com - Version: 6.3.3 or higher - When the application is running with `yarn rw serve` command. - Version: 6.3.2 or lower - When the application is running with `yarn rw dev` command. --------- Co-authored-by: yuichi.nishitani <hawkk9.public@gmail.com> Co-authored-by: Dominic Saadi <dominiceliassaadi@gmail.com>
What's not working?
It doesn't look like the fastify server is returning the index when a query parameter contains a period.
For example, appending this to any routed URL works:
/your-route?this_Should_be_ok
But this doesnt:
/your-route?this_Shoul.d_be_ok
Instead of being served the index html file, I receive a 404
How do we reproduce the bug?
Tack ?this_Shoul.d_be_ok onto any path
What's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: