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.

Encoded slashes not working as expected in production in a catch-all route

See original GitHub issue

What version of Next.js are you using?

10.0.2

What version of Node.js are you using?

14.16.1

What browser are you using?

Firefox & Brave

What operating system are you using?

Ubuntu Linux

How are you deploying your application?

Vercel

Describe the Bug

My application is using a catch-all route which tests that the slug length is 3 or less and returns notFound if other. The last slug part has an arbitrary content, including another slashes, but it’s encoded using encodeURIComponent so it doesn’t get to conflict with the catch-all filter. Locally, everything works correctly, but in production (in Vercel) breaks when using slashes, as reported in TheDavidDelta/lingva-translate#18. I’ve tested this issue reports and it’s not only in links but in everything that contains a slash i.e. https://lingva.ml/en/es/like %2F dislike, even though locally it works great (fell free to clone that repo to test it).

Expected Behavior

To don’t break nor send 404 when using encoded slashes on filtered catch-all routes, as works locally.

To Reproduce

Go to https://lingva.ml and write any translation that contains a slash.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thedaviddeltacommented, Jul 12, 2021

Sorry for the late reply @ijjk.

Thanks for your help. I’ve just tested it out and it seems to work perfectly. Here’s my previous example and this is the same URL working on the updated preview branch. I’ve also tested the example from the guy that opened the issue in my repo as well as its current behaviour.

I think it’s ready to merge. Thanks again.

Regards, David.

1reaction
ijjkcommented, Jul 6, 2021

Hi, this should be fixed in v11.0.2-canary.6 of Next.js, please upgrade and give it a try!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Encoded slashes not working as expected in production in an ...
My application is using an API catch-all route which tests that the slug length is 3 or less and returns 404 not found...
Read more >
ASP.NET Core MVC: Problem with routing argument that ...
I'm encoding this forward slash using %2F , however, it seems like ASP.NET Core MVC decodes the URL, then matches routes, as I'm...
Read more >
Rewrites - next.config.js
rewrites is an async function that expects to return either an array or an object of arrays (see below) holding objects with source...
Read more >
The Art of Routing in Flask - Hackers and Slackers
Empower your Flask application to grow dynamically with intelligent routes and well-structured views.
Read more >
Client-Side Routing In Next.js - Smashing Magazine
This is because the catch-all route is “strict”. It either matches a slug, or it throws an error. If you'd like to avoid...
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