If the request URL
test.com/gifts.
ngx.var.uri
/ gifts /
test.com/gifts
location / gifts { try_files $ uri @url_change; } location @url_change { default_type text / html; content_by_lua ' ngx.say (ngx.var.uri) '; }
I really don't understand what you want, but if you want the actual full url, I think you can use this
$http_host$request_uri;
ngx.say(ngx.var.host .. '/' .. ngx.var.uri)
$host, .. ngx.var.host?
$host
ngx.var.host
- uri, :
ngx.var.request_uri
So far ngx.var.uri, the new uri after rewriting ngx.
Try:
ngx.say(ngx.var.request_uri)