Multiple Cloudflare Workers route to different URL paths

Hi everyone, I want to route several Cloudflare Workers to different paths on a subdomain. For example: Page1: subdomain.example.com/Page1 Page2: subdomain.example.com/Page2 I've tried but it does not work. Here's my wrangler.jsonc:
{
"name": "example-project",
"compatibility_date": "2025-06-17",
"assets": {
"directory": "./site"
},
"routes": [
{
"pattern": "subdomain.example.com/Page1/*",
"zone_name": "example.com"
}
]
}
{
"name": "example-project",
"compatibility_date": "2025-06-17",
"assets": {
"directory": "./site"
},
"routes": [
{
"pattern": "subdomain.example.com/Page1/*",
"zone_name": "example.com"
}
]
}
3 Replies
Thomas
ThomasOP6mo ago
When I deployed, it seems that it matches the assets located in: site/Page1/, not site. I've spent several hours on this. If you've done this before, please help me out a bit. I'm new to Cloudflare workers. My sites are built with mkdocs
Razboy20
Razboy206mo ago
Hi @Thomas! I would recommend reading through these docs if you haven't already, hopefully these provide some help: https://developers.cloudflare.com/workers/static-assets/routing/advanced/html-handling/ Looking into it a bit more, I believe that this would be intended behavior based on this documentation: https://developers.cloudflare.com/workers/static-assets/routing/advanced/serving-a-subdirectory/
In this example, requests to example.com/blog/ will serve the index.html file, and requests to example.com/blog/posts/post1 will serve the post1.html file.
Thomas
ThomasOP6mo ago
Thank you

Did you find this page helpful?