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:
curl https://www.cloudflare.com/
When I choose to avoid using DNS by giving host's IP address to curl:
curl http://198.41.214.163/
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://198.41.214.163/
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://198.41.214.163/
How can i overcome this problem?