[Bug] Direct Uploads failed to parse _redirects and _headers files

From Cloudflare Pages Updates - 2022-06-10 - #8 by Walshy.

There’s actually already a thread here (see Redirects doesn't work correctly when using direct upload in Pages), but since it’s been closed, I’ve opened this one.

The problem is that the _redirects and _headers files cannot be parsed when publishing the Pages site via Direct Uploads. But everything works fine when publishing the same files via Git. And this problem has existed since the first day the Direct Uploads feature was released.

The Pages site domain: 3e5f46af-8446-4e5c-b789-9a64fa113287.pages.dev.

The _redirects file content:

/:_ /
/:_/* /

The _headers file content:

https://:project.pages.dev/*
	X-Robots-Tag: noindex
https://:project.pages.dev/*
	Cache-Control: public, max-age=60

Here are some screenshots:

/cc @Walshy @fernvenue

Seems to work fine for me - other than it not showing in the dashboard.

image

Are you just reporting the dashboard bug or are you saying they don’t work at all for you?

As you can see in the _redirects file in my example:

curl -I https://3e5f46af-8446-4e5c-b789-9a64fa113287.pages.dev/foo/bar should return 302 to redirect the request to root. But instead, it returned 200.

That seems like more of an issue with your specific redirect rather than the _redirects file in general.

/foobar / works fine and 302’s to /

Seems like the rule is regarded as valid by the build environment but not direct upload - but _redirects in general does work.

It seems so. I just published a new Pages site (domain du-feature-test.pages.dev) via Git with the exact same files and everything works as I expect.

I thought they were supposed to behave consistently. If they were designed this way on purpose, then I’m sorry I called it a bug.

And for _headers, I just tested it, and it parses fine. So there seems to be just a dashboard bug for it.

Yeah - /:_/* / works in Git

curl https://pages-du-test.pages.dev/foo/bar -sSI
HTTP/1.1 302 Found

But not in wrangler pages publish or the dashboard upload

curl https://foo-86b.pages.dev/foo/bar -sSI
HTTP/1.1 200 OK

Could you make an issue on the wrangler repo Kian?

1 Like

Thanks for the report! This is now fixed

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.