I would like to expose a service written in Perl to localhost HTTP requests. I do not want to modify Apache configuration. How to check whether a Perl CGI HTTP request originates from localhost?
I want for this check to succeed even if this call is made through a virtual host eg. https://www.myserivce.com/hidden/service.pl given that the call is made from inside of http://www.myserivce.com.
I have used the following code:
I do not think it covers all cases, but seems to work with my setup. If anybody knows a generic solution then please submit it here.