Getting request's source site

Steven D'Aprano steve at pearwood.info
Tue Aug 27 05:23:23 EDT 2013


On Mon, 26 Aug 2013 08:03:33 -0700, Guy Tamir wrote:

[asking about Referer header]
> In what cases will i have this header? is there something i can do to
> enforce having it? Are there any other ways?

The Referer header is in the HTTP Request that is made to your server. 
What server are you using? If it is a custom server written in Python, 
then this is a legitimate question for this list. Otherwise, check the 
documentation for your server. Any decent web server will already deal 
with referrers, and any decent web analytics software will show you the 
information collected.

http://en.wikipedia.org/wiki/List_of_web_analytics_software


As for enforcing a referer, that's a really low, dirty thing to do, and I 
will not give you any hints as to how to do such a thing. Websites that 
take different actions depending on where you are coming from are the 
lowest of the low. Need a hand disposing of a body? Yeah, there are 
legitimate reasons for this, I'll help if I can. Forcing visitors to your 
website to set the Referer header? Nope, no way.


-- 
Steven



More information about the Python-list mailing list