Using Host Header in curl

When you have multiple websites hosted on a server, if you want to access one of the site using curl to IP of the server, then you need to pass the Host header value.

For example

curl --header "Host: www.mydomain.com" SERVER_IP_HERE

If you want to show debug info, add –verbose

curl --verbose --header "Host: www.mydomain.com" SERVER_IP_HERE

Here is another way to do it

curl  https://serverok.in --connect-to ::172.67.201.123

Back to curl

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *