perlnginxmod-perl

how to get http_referer in nginx mod_perl


I have an nginx mod perl module which gets data and takes action based on parameters in my script I am not able to get the http referer

I am trying

$r->header_in("http_referer")   # Gives an undefined string
$r->headers_in()    # func not defined

How can I get all the headers passed by the http client inside my function


Solution

  • $r->header_in("http_referer")   # Gives an undefined string
    

    The request header field you are looking for is not http_referer but referer, i.e. useheader_in("referer"). See MDN documentation for more on this field.