I have a page rule that simply redirects a URL to a different location. I want to move that over to a worker.
The page rule settings:
Forwarding URL (Status Code: 301 - Permanent Redirect, Url: https://new.com/File.zip)
The %20 is the URL encoded space. This page rule has always worked without issue.
Now I set up a worker route and link it to a worker script. I wait a few minutes and it doesn’t work - the request doesn’t enter the worker and goes straight to the origin. I then remove the %20 and just leave a space. It doesn’t work then either. I then test my redirect worker script with a URL that doesn’t have a space and it works straight away.
I can’t figure out why this URL works in a page rule but not a worker route. The issue is not with the script because the request doesn’t get that far. The route is obviously not matching up. Any idea why?
Haha, yep, I can reproduce this. What a nice little bug. I will send this over to the team and make sure it reaches the right people
Thank you very much!
Spent a few hours trying to find out what I was doing wrong.
@WalshyMVP Is there any update?
Hey, there’s an internal ticket for it but I don’t think it’s a super high priority fix.
@WalshyMVP Any updates on the ticket since then?
Sadly not, I know there’s a ticket but I’m not sure when it will be resolved (It may have been so do check but I haven’t had an update).
@WalshyMVP Tested and confirmed not fixed as of now. I’ll check back in a month or so.
@WalshyMVP If you have time can you check for an update on the ticket? Thanks!
I have the same issue, but in reverse, actually.
I’m building an experimental URL shortener in Workers, and one of the keys includes a space. When I use the direct workers.dev link, it works just fine. However, using an HTTP route for a subdomain, it fails.
I’m seeing the same issue when trying to return an object in a R2 bucket from a Worker (specifically a Pages function) where it has a space in the URI name. I have:
And the Worker returns a Not Found. I’ve tried encoding the URL and it still doesn’t work.
Any update on this issue?