Today, I'm going to discuss more about the HTTP Referrer header. As I've explained in my previous posts, a header is a key value pair separated by color (:). Click here to familiar with HTTP protocol internal details.

Each request will have a format and as part of it, client will send HTTP headers. As per the HTTP specifications, a header REFERRER is an optional information that client can send to server. This piece of information would be useful to know which URL has the link or reference to the current requesting URL.
Example: Consider you're searching for a keyword in Google, it shows the results when you hit enter. Here if you click any link, REFERRER header will be passed as Google search URL as it has the link to the current requested URL.

If you're working on any web technologies like Java Servlets, JSP, Struts, Springs, .NET, or PHP and if you would like to know which page has the current requested URL reference, then you can get it by using the REFERRER header.

Here is the construct to get the REFERRER header in Java
request.getHeader("REFERRER");


Each programming language has a construct to get the headers. Enjoy programming...

Click here to know view all my posts on HTTP

Click here to check out other programs that I've developed.