Jumped the gun there. There's a sting in the tail.
# GET /test_page.php
location ~ .+\.php$ {
location ~ ^/test_page\.php$ {
access_by_lua '
local res = ngx.location.capture("/phpids")
if res.status == ngx.HTTP_OK then
ngx.exec("@proxy")
end
if res.status == ngx.HTTP_FORBIDDEN then
ngx.exit(res.status)
end
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
';
}
rewrite_by_lua 'ngx.exec("@proxy");';
}
Will result in the rewrite by lua line being executed instead of the
access by lua within the sub location. Changing the access by lua in
the sub location to rewrite by lua executes the script.
In any case, my original config is the preferred to get workingas I
need the request params to be passed along the redirection chain.
Better wait until agentzh wakes up in his timezone.