I am fetching an external resource through the
fetch() API in one of my workers. The resource is identified by an IP address – there is no domain for it. The request fails because it’s intercepted by Cloudflare and I get the following error:
Please enable cookies.
Error 1003 Ray ID: 48512b6700dec190 • 2018-12-06 19:30:52 UTC
Direct IP access not allowed
You’ve requested an IP address that is part of the Cloudflare network. A valid Host header must be supplied to reach the desired website.
What can I do?
If you are interested in learning more about Cloudflare, please visit our website.
Cloudflare Ray ID: 48512b6700dec190 • Your IP: 2a06:98c0:3600::103 • Performance & security by Cloudflare
Now, the server is definitely not behind Cloudflare, and I don’t even have a domain for it. I tried to set the Host header with the same IP address, but I get the same response. What is the solution in this case?