Fetching a string by parsing URL
sudharshanr
nginx-forum at nginx.us
Thu Jul 23 19:32:26 UTC 2015
For some reason, I'm getting it as null. This is my config file:
map $uri $last_path {
~*/(?<pathname>[^/]+)/?$ $pathname;
}
server {
listen 80;
root /basefolder;
error_page 500 501 502 503 504 =
/error5x.html?name=$arg_name&path=$last_path;
location ~*/error5x.html? {
alias /Desktop/error5x.html;
}
location ~*/path1/ {
if (-f $document_root/error503.html) {
return 503;
}
....
}
However, if I update the location directive as below:
location ~*/error5x.html? {
alias /Desktop/error5x.html?name=$arg_name&path=$last_path;
}
I get a file not found error. But when I check the nginx log, I can see that
it is fetching the $last_path variable. Just that it takes it as part of the
file name and throws a 404 error. So it's something like "open()
"/Desktop/error5x.html?name=abc&path=xyz" failed (2: No such file or
directory),".
Thanks.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,260458,260531#msg-260531
More information about the nginx
mailing list