Cloudflare Pages HTTPS redirect not an option

I have set up a site using the new Pages beta and while it does support HTTPS, if I visit on HTTP it does not redirect to HTTPS and I can’t see a way to configure it to do so.

Is this possible?

Thanks,

Clement

The “Always Use HTTPS” option in SSL/TLS → Edge Certificates doesn’t redirect for you?

1 Like

Same problem here.
Always Use HTTPS didn’t fixed it

@sdayman this isn’t a normal domain within Cloudfront, but instead a site created with the new Pages beta. For the domain itself “Always Use HTTPS” is enabled but that doesn’t seem to affect subdomains created via Pages beta.

Hello @winseybash and @clausly4,

This is a known bug with Pages. It’s currently bypassing all Cloudflare normal rules. It’s waiting for a fix from another team. It shouldn’t take long…

A temporary fix would be to use a Worker to fetch from the .pages.dev domain, but it obviously requires Workers invocations and it may incur costs.

5 Likes

@matteo Thanks for this, it explains some behaviour I’m experiencing too. Routing in Pages seems to override everything. When fetching from a route attached to a worker I get a 404 instead of getting the worker called

How would I set up my worker on a .pages.dev route? Obviously I don’t own that domain/zone, and if I try to set a route with wrangler it fails because I don’t have the account id. I assume I wouldn’t be allowed anyway even if I had it?

Is there a place where we can track when the bug fix is deployed?

The Worker needs to be deployed on the domain you want to use as custom domain, not the other way around.

To track it join the Workers Discord server at https://discord.gg/C69TZXGedt.

I thought you meant there was a bug that wouldn’t allow that

This is my example setup:

worker set to mydomain.com/worker
page set to mydomain.com

If I do curl mydomain.com/worker I get a 404 because there is no html page in the static site deployed at mydomain.com. The worker never gets called

There is, you need to delete the custom domain on Pages and fetch the pages.dev subdomain via Workers from the custom domain.

Ok I get what you meant in your message now. I totally get this is beta, but am I right in thinking that one day this won’t be the case? will workers work in tandem with pages?

Exactly. The team is waiting on another team to fix a thing. It will work just as any other would, if you proxy the record with all Cloudflare features.

that’s excellent! thank you so much @matteo for being so quick at responding in a community forum!

1 Like

I would highly suggest you join the Discord server… all the things I’m saying here were said there before. I would love for the Workers team to be more active here, but they seem to stay more over there.

1 Like

This bug has been fix today for me :wink:

To close the discussion. This has been fixed and all Pages domains (and custom domain), now correctly redirect to HTTPS by default.

If this is not yet the case for older projects that have been added at the start of the beta, delete and add the project again.

1 Like

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