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
Error page if url contains percentage, which happens on redirection with non ascii characters in url #32035
Comments
There is a weird case of it working for "%60", not sure why |
Just to verify since you left some details out, are you using something like the following?: In ...
export const getServerSideProps = async (ctx) => {
return {
redirect: {
destination: `/page/${encodeURIComponent(ctx.query?.id || "")}`,
permanent: false,
},
}
} And then you have a page like |
Hi @balazsorban44 , simplified version of what we are using
Edit: Let me know if you need more info Edit2: yes we have pages/page/[courseid].js. Is encodeURIComponent suggested ? |
@balazsorban44 encodeURIComponent fixes the issue the url is not changed and loads correctly. Thank you so much I am not sure whether to close the issue because %E0 as param directly which à was being converted to still breaks the page, even on invalid url or page example next-js url https://nextjs.org/%E0 or random like this https://nextjs.org/%E0G1 |
Is this potentially related to #33763? |
I will try to confirm this with new canary build this week @timneutkens |
@timneutkens This issue is reproducible on 12.0.10-canary.1 I used sample nextjs application Steps-
|
Thx, I experience exactly the same problem. I just went live on vercel with Next 12.1.4. I use some basic rewrites and I also use the middleware example for international routing for prefixed default language. You can check it here. Working URL: Add a %, and there is a bad request error: There is no log entry. |
I experience exactly the same problem with ? |
What version of Next.js are you using?
12
What version of Node.js are you using?
12.22.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
next start
Describe the Bug
we get 400 Bad request if page contains "%", we also don't get error/issue on terminal it just compiles _error
This occurs because we are redirecting url's with non ascii characters, our page old-page/à becomes page/%E0
I think while redirecting it is encoding url, so we get %. nevertheless it should not break i think
Expected Behavior
Redirect correctly, without changing url
To Reproduce
Open a url with %
The text was updated successfully, but these errors were encountered: