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 file /Desktop/error5x.html?name=abc&path=xyz not found.
Thanks.