I want to send custom headers to the host while using proxies. Take a look at the examples below. Explaining the situation with examples was easier.
This works fine as expected:
When I choose to avoid using DNS by giving host's IP address to curl:
Website gives me this error page -->
"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."
If we supply correct host header name, it will work normal again without using DNS:
curl --header "Host: cloudflare.com" http://22.214.171.124/
But when I do the same while using a proxy tunnel, curl doesn't send the headers to host, so i get "Direct IP access not allowed" error from to the host:
curl --proxy "http://PROXY_IP:PORT" --header "Host: cloudflare.com" http://126.96.36.199/
How can i overcome this problem?