http_headers
This is an old revision of the document!
Flag | Description |
---|---|
-I, –head | Fetch the HTTP-header only |
-v, –verbose | Fetching is more talkative. Used for debugging |
-s, –silent | Silent or Quiet (Mute). Don't show progress meter or error messages |
-i, –include | Header plus content |
-X , –request | Specify a customer request when communicating with HTTP web server |
Troubleshooting a website. You can replace http://website.com with http://localhost if you wish to test the domain on the local machine
1 |
curl -Iv -X GET 12.34.56.78 -H 'Host: example.com' |
The following command is used to test a https domain. -k will skip the certificate check
1 |
curl -Ik -X GET https: //website .com |
Testing a vhost on the localhost
1 |
curl -Iv -x GET localhost -H 'Host: vhost.com' |
Body String Match
-s flag hides the download speed etc
1 |
curl -is https: //tickets .daysoutwithkids.co.uk /longleat | grep Maintenance |
1 2 |
<title>Days Out With Kids | Maintenance< /title > <h3>Sorry, Site Under Maintenance< /h3 > |
1 |
curl -i https: //tickets .daysoutwithkids.co.uk /longleat | grep Maintenance |
1 2 3 4 5 |
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 9885 100 9885 0 0 280k 0 --:--:-- --:--:-- --:--:-- 9653k <title>Days Out With Kids | Maintenance< /title > <h3>Sorry, Site Under Maintenance< /h3 > |
Testing to see if a website returns a certain string. Body match strings are often used in monitoring alerts
1 |
lynx -dump http: //lukeslinuxlessons .co.uk | grep 'string match' |
If the website has an ssl certificate you can also apply the 'k' option to bypass the certificate check. e.g:
1 |
curl -ik https: //website .com | grep body_match_string |
http_headers.1441702564.txt.gz · Last modified: 2024/05/23 07:26 (external edit)