We are hosting a static site on Cloudflare workers and have HSTS enabled. However, I can not get example.com to redirect to www.example.com using page rules following the Cloudflare tutorial here:
A. Workers Routes
On workers we have the following routes pointing to our worker:
*example.com/*
example.com/
example.com/*
B. Domain DNS
On the domain DNS there are two A records proxied through Cloudflare.
The first A record points example.com to 192.2.0.1
The second A record points www to 192.2.0.1
Note I can not change the first record from example.com to @, simply as the Cloudflare DNS interface is changes @ to example.com when I save the record.
C. Page Rules
We have two rules, one for www redirect and one for caching everything.
The first rule:
https://example.com/* forwarding URL 302 temporary redirect to https://www.example.com/$1
The second rule: https://www.example.com/*, cache everything.