Hello,
I have been trying to implement some internal redirection using ngx.exec() call.
Example 1 :
location /foo {
content_by_lua 'return ngx.exec("/bar","a=1")';
}
location /bar {
internal;
proxy_pass http://192.168.1.2 ;
}
With above example, upstream server (192.168.1.2) receives request for /bar?a=1 so it returns "The page isn't redirecting properly".
Example 2:
location /foo {
content_by_lua 'return ngx.exec("@bar")';
}
location @bar {
internal;
proxy_pass http://192.168.1.2 ;
}
With this example, upstream server receives request for /foo which is proper so returns 200 with actual content.
Would anyone explain what is wrong in example one? Is it pointing to any bug or this is proper behavior?
If I use proxy_pass http://192.168.1.2$request_uri in first example then it works and sends request for /foo to upstream server. Is it mandatory to use $request_uri to proxy_pass ? So far I never required to use any extra parameters (i.e. $request_uri) to proxy_pass directive.
Thanks,
Makailol