How do I pass the referrer (HTTP referrer)as an HTTP header field using curl command under Linux OR Unix operating systems?
The curl client / command can send the "Referer Page" information to the Web (HTTPD) server. By default, when visiting a webpage using any HTTP client, the referrer or referring page is the URL of the previous webpage from which a link was followed. This can be changed using the following syntax:
curl --referer http://example.com/bot.html http://www.cyberciti.biz/
This can be used for referrer spoofing. In this example change referrer information to "fooBar" to prevent a web page from gathering accurate data on the identity of the user's previously visited web page:
curl --referer fooBar www.cyberciti.biz
The HTTP referer can be used for testing and debugging complex setups. In this example, if you pass "debugLB" as HTTP referrer, you will see 'X-Cache' and 'Via' debug headers:
curl --referer debugLB http://example.com/bot.html http://www.cyberciti.biz
Sample outputs:
HTTP/1.1 200 OK
Cache-Control: max-age=5184000
Connection: Keep-Alive
Content-Type: text/html
Date: Sun, 06 Nov 2011 21:53:08 GMT
Expires: Thu, 05 Jan 2012 21:53:08 GMT
Server: nginx
Via: 1.1 mfc1.static.cache.cyberciti.biz:80
X-Cache: HIT
X-Whom: l3-biz-cyber
X-Galaxy: Andromeda-1
Please note that you need to configure web server OR app server for "debugLB" HTTP referrer in advance.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop













{ 0 comments… add one now }