Re: Nginx postgres problem

2014-03-05 Thread Yichun Zhang (agentzh)
Hello! On Wed, Mar 5, 2014 at 2:21 PM, arunh wrote: > Depending on the parameters a,b,c and d I will get the IP and port of the > destination server (by communicating with postgres) where the request must > be redirected to ie the new url is of the form: > http://IP:port/a/b/c/d. > You need eithe

Re: Nginx postgres problem

2014-03-05 Thread arunh
Hello Yichun, The use case I am trying to test is the client sends a request to nginx server with some parameters say "/a/b/c/d": http://NginxHost/a/b/c/d Depending on the parameters a,b,c and d I will get the IP and port of the destination server (by communicating with postgres) where the reques

Re: Nginx postgres problem

2014-03-05 Thread Yichun Zhang (agentzh)
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 } ); >

Re: Nginx postgres problem

2014-03-05 Thread Yichun Zhang (agentzh)
Hello! On Wed, Mar 5, 2014 at 8:39 AM, arunh wrote: > I had to make a series of postgres calls so I used content_by_lua along by > sharing the varialbes as I had to query tables from multiple databases. > No, you should use rewrite_by_lua exclusively for all the ngx.location.capture calls here I

Re: Nginx postgres problem

2014-03-05 Thread arunh
Hello Yichun, Thank you very much for the reply. I have used ngx.location.capture for extracting the values from postgres database as suggested by you. I had to make a series of postgres calls so I used content_by_lua along by sharing the varialbes as I had to query tables from multiple databases

Re: Nginx postgres problem

2014-03-04 Thread Yichun Zhang (agentzh)
Hello! On Tue, Mar 4, 2014 at 7:15 AM, arunh wrote: > But when I try to print the value of "$1" variable and also after assigning > it to the variable "$tenantID" I do get the value. > I guess in the eval block the postgres_escape is not getting set. > The "eval" directive always runs before the

Nginx postgres problem

2014-03-04 Thread arunh
Hello All, I am newbie to Nginx and I am using Nginx with PostgreSQL database. When there is a http request to the server I want to extract one of the input variables in the request, query the Database and retrun the result, the variable inside the postgres_query is empty. But when I try to prin