If you use curl, and you need to make your command work as if it was referred from another website, this may be relevant to you.
Is it referrer or referer?
The correct spelling is referrer, but for some reason, the mispelled REFERER sneaked in instead of REFERRER.
Curl command without HTTP Referer
I will make a curl command to my /humans.txt
webpage running on my local MacBook and tail it.
curl https://aruljohn.beta:8080/humans.txt
The Nginx webserver logs showed this:
127.0.0.1 - - [24/Sep/2025:14:32:11 -0400] "GET /humans.txt HTTP/2.0" 200 2630 "-" "curl/8.7.1"
Curl command with HTTP Referer using -e
I will make a curl command to my /humans.txt
webpage and set the HTTP_REFERER so it will appear to come from https://slashdot.org/
We will use curl with -e
:
curl -e "https://slashdot.org" https://aruljohn.beta:8080/humans.txt
The Nginx webserver logs showed this:
127.0.0.1 - - [24/Sep/2025:14:37:15 -0400] "GET /humans.txt HTTP/2.0" 200 2630 "https://slashdot.org" "curl/8.7.1"
Note the referring page https://slashdot.org
Curl command with HTTP Referer using --referer
--referer
works just like -e
.
Make a curl command using --referer
.
curl --referer "https://slashdot.org" https://aruljohn.beta:8080/humans.txt
Nginx webserver logs:
127.0.0.1 - - [24/Sep/2025:14:44:00 -0400] "GET /humans.txt HTTP/2.0" 200 2630 "https://slashdot.org" "curl/8.7.1"
Curl command with HTTP Referer using -H
Adding -H
is another way of adding HTTP referer using curl.
curl -H "Referer: https://slashdot.org" https://aruljohn.beta:8080/humans.txt
The Nginx webserver logs showed this:
127.0.0.1 - - [24/Sep/2025:14:40:32 -0400] "GET /humans.txt HTTP/2.0" 200 2630 "https://slashdot.org" "curl/8.7.1"
Conclusion
Did you find this blog post useful? Do you have another way to add a referer value to your curl command? Let me know in the comments below. Thanks for reading.
Related Posts
If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.