question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error page if url contains percentage, which happens on redirection with non ascii characters in url

See original GitHub issue

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 image

This occurs because we are redirecting url’s with non ascii characters, our page old-page/à becomes page/%E0

  return {
    redirect: {
      destination: `/page/${query?.id || ""}`,
      permanent: false,
    },
  };

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 %

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
its-mXccommented, Jan 31, 2022

I will try to confirm this with new canary build this week @timneutkens

0reactions
1377sayabacommented, Sep 22, 2022

I experience exactly the same problem with ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP Redirect with non-ASCII characters in the URL
The cause of the error is that HTTP redirects are restricted to ASCII characters in the redirect result, as per the RFC. I...
Read more >
How to Fix Non-ASCII Characters in a URL - Sitechecker
We'll show you how to fix non-ASCII characters within a URL. Learn more about what characters are valid for URLs.
Read more >
How to stop error 400 when URL contains a percent % symbol ...
Have the 'error 400' page check for a % in the URL on the server and then redirect to another page (or 404...
Read more >
Using URL encoding to handle special characters in a ...
For instance, the "#" character needs to be encoded because it has a special meaning of that of an html anchor. The <space>...
Read more >
URL Encoding | Google Maps Platform
Some characters cannot be part of a URL (for example, the space) and some other characters have a special meaning in a URL....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found