Too many redirects when making fetch requests from a worker

When I make a fetch request from a CF Worker, I'm getting a "Too many redirects" error from the fetch. The redirect URLs aren't changing, each new location is the same URL as the previous.
This only happens when making requests to the same domain that the worker lives on (different subdomain). When making a request manually from my device, there are no redirects. It happens with any URL on the same CF domain.

For example, if my CF worker lives on worker.example.com. When I use
fetch
in the Worker to make a request to https://api.example.com/somepath, the Fetch errors out with an infinite redirect, where each redirect location is https://api.example.com/somepath. I can make manual requests to https://api.example.com/somepath from my device and do not see any redirects.
Was this page helpful?