Nginx postgres problem
Yichun Zhang (agentzh)
agentzh at gmail.com
Wed Mar 5 20:03:51 UTC 2014
Hello!
On Wed, Mar 5, 2014 at 8:39 AM, arunh wrote:
> location /postgresrewrite
> {
> rewrite ^ "http://$nodeIP:$port/$inputURI";
> }
>
[...]
> rewrite_by_lua '
> res5=ngx.location.capture(
> "/postgresrewrite", { share_all_vars = true } );
> ';
>
Forgot to mention that redirects in a subrequest won't affect its
parent requests. They're separate requests anyway. Try thinking about
it :)
Use either ngx.req.set_uri() or ngx.exec() in rewrite_by_lua. (If you
use content_by_lua, then you can only use ngx.exec for internal
redirects).
See
https://github.com/chaoslawful/lua-nginx-module#ngxreqset_uri
https://github.com/chaoslawful/lua-nginx-module#ngxexec
Also, it is a bad idea to enable "share_all_vars" due to potential bad
side-effects that lead to weird issues that are extremely hard to
debug. Just share the NGINX variables you want to share.
Best regards,
-agentzh
More information about the nginx
mailing list