trying to host a pages project at example.com/docs rather than the root

How would I go about doing this? I've been looking at origin rules but i don't see an option for changing the host header like the cloudflare docs say should be possible.
8 Replies
Xe
XeOPā€¢3mo ago
i don't really want to run a worker since this should be possible with origin rules
Erisa
Erisaā€¢3mo ago
changing the host header in an origin rule requires an Enterprise plan
Xe
XeOPā€¢3mo ago
gotcha, this is not really that well documented I could not find the limits anywhere lol
Xe
XeOPā€¢3mo ago
yeah ok i'm blind šŸ˜†
Xe
XeOPā€¢3mo ago
Cloudflare Docs
Available settings | Cloudflare Rules docs
The following sections describe the available settings in Origin Rules.
Erisa
Erisaā€¢3mo ago
yeah it should be on there as well, you can probably leave feedback about it with the šŸ‘ / šŸ‘Ž thing on the side or https://github.com/cloudflare/cloudflare-docs/issues/new/choose
Xe
XeOPā€¢3mo ago
So I threw a worker in front of it, but now I also want to cut off the pages.dev domain. Is there a way I can make an internal request with a worker, or a way I can avoid rules that would otherwise redirect the pages.dev back to the canconical source of website.dev/docs ...gonna just use static assets i think lol
Workers which have static assets cannot be routed on a URL which has a path component.
šŸ˜” got it to work, thanks erisa! The solution I've ended up with was converting my site to a workers static assets, because its entirely static, then throwing a second worker in front of it at the route i want everything to appear at then using service bindings so the static assets are never exposed publicly aside from through the subpathed router

Did you find this page helpful?