For Workers & Pages, what is the name of the domain?
test domains
What is the issue or error you’re encountering
I am trying to setup multiple workers at api.mydomain.com with different paths, but am not sure how to configure the routes section in wrangler.jsonc
What steps have you taken to resolve the issue?
I want my worker’s APIs to be available at api.mydomain.com/worker
. But if I set that in the routes array in wrangler.jsonc like this:
"routes": [
{
"pattern": "api.mydomain.com/worker1/*",
"zone_name": "mydomain.com"
}
]
It doesn’t work because there is no DNS record set up for api.mydomain.com.
If I define a custom domain as part of the routes like this:
"routes": [
{
"pattern": "api.mydomain.com",
"custom_domain": true
},
{
"pattern": "api.mydomain.com/worker1/*",
"zone_name": "mydomain.com"
}
]
My API becomes available at api.mydomain.com, which is not what I want. Also, api.mydomain.com/worker1
never works, no matter what variations I try.
Can anyone tell me what configuration I need to set to make my API available at a specific path of api.mydomain.com?