
Hands-on with cURL to play with proxy IP's Host header
Recently, a lot of data collection old iron asked, why use the proxy IP to access the site is always blocked? There is a hidden barrier calledHost request header settingsThe Host header is the key code. Just like when you go to a courier station to pick up a package, it's not enough to just say your name but you also have to report the pickup code, and the Host header is that key code word.
What the hell is a Host head?
Simply put, the Host header is telling the server: "I'm looking for website xxx". Some websites will check this parameter, and if they find that it doesn't match the actual address visited, they will just block you as a robot.
curl -H "Host: www.target.com" http://1.2.3.4
The above line of code is like saying: "Although I am connected to the IP 1.2.3.4, but in fact to find www.target.com的". At this point, the proxy IP must be accompanied by a change in the Host header, otherwise it will be exposed in minutes.
Practical cURL proxy settings in four steps
Here's a chestnut using ipipgo's proxy service:
curl -x http://user:pass@proxy.ipipgo.io:8080
-H "Host: www.targetsite.com"
https://目标网站真实IP地址
Must See Points:
| parameters | corresponds English -ity, -ism, -ization | example value |
|---|---|---|
| -x | Specify a proxy server | proxy.ipipgo.io:8080 |
| -H | Setting the request header | Host: www.xxx.com |
Common Rollover Scene QA
Q: Why is the Host header still 403 after I set it?
A: 80% is the proxy IP quality is not good, with ipipgo'sLong-lasting static proxiesThe Host header is automatically adapted.
Q: Do I need to set multiple request headers at the same time?
A: It is recommended to add User-Agent camouflage:
-H "Host: www.xx.com" -H "User-Agent: Mozilla/5.0..."
Q: What should I do if the proxy IP suddenly fails to connect?
A: The ipipgo backend has aIntelligent Switchingfunction, automatic line change is 10 times faster than manual.
Guide to avoiding the pit
1. When you encounter SSL certificate error, remember to add the-kparameter (but don't use it for sensitive operations)
2. Don't set the timeout more than 30 seconds, suggest using ipipgo's5-second channel
3. If you need to switch hosts frequently, you can use their API dynamic proxy pool to save time.
And finally, ipipgo's proxy support!Host header pre-bindingThe company's website has been configured directly in the background, so you don't even need to change the code. The actual test with their residential agent + correct Host settings, the collection success rate can soar from 30% to 90%+.

