I want to access nginx $uri variable in perl, the following is my
nginx.conf
worker_processes 1;
location / {
add_header "perlvar" $perlvar;
empty_gif;
}
}
}*
*
but it doesn’t work, nginx $uri variable is empty in perl, can somebody
figure out what the problem is?
Thanks!
li_zJay
2
On Thu, Sep 01, 2011 at 06:01:31PM +0800, li zJay wrote:
I want to access nginx $uri variable in perl, the following is my nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
perl_set $perlvar ‘sub {return “ngx_uri:$uri”;}’;
You should use $r->variable() method to get nginx variable:
‘sub {
my $r = shift;
return $r->variable(“uri”);
}’;
or special $r->uri() method for URI:
‘sub {
my $r = shift;
return $r->uri;
}’;
but it doesn’t work, nginx $uri variable is empty in perl, can somebody
figure out what the problem is?
Thanks!
nginx mailing list
[email protected]
nginx Info Page
–
Igor S.