cloudflare / cloudflare/workers-sdk
🐛 BUG: _redirects routes using placeholders or splat don't work with direct upload via wrangler
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 187
Description
### Which Cloudflare product(s) does this pertain to?
Pages
### What version of `Wrangler` are you using?
2.9.0
### What operating system are you using?
Mac
### Describe the Bug
I recently converted a project from using automatic deploys to use direct uploads from CI. After completing the transition, I found that all redirects including a splat/placeholder stopped working. So the same `_redirects` file which worked on automatic uploads stopped working with direct uploads.
When using direct upload via `wrangler pages publish`, instead of converting the splat/placeholder into its actual value, the value simply becomes the token literal. It's easier to see than it is to explain, so I've created an extremely minimal reproduction repo here: https://github.com/trappar/cf_pages_redirects_bug
And I've deployed this to two separate CF Pages projects:
* Via Git Integration - https://cf-pages-redirects-bug.pages.dev/
* Via `wrangler pages publish` - https://cf-pages-redirects-bug-direct-upload.pages.dev/
Try clicking the links in both repos and observe the resulting URL. In the one that was deployed via git integration, everything works as advertised. In the one deployed via wrangler the redirects don't work correctly.
I don't actually think it's likely that this is a bug directly with wrangler. I've looked at the related code and it looks fine. My guess is that this is a bug with something server-side. Because of this belief, I originally opened a support ticket instead of creating this issue. Support simply told me to open a ticket here, so here I am.
Contributor guide
Assessment
This issue has not been assessed yet.