Welcome! Log In Create A New Profile

Advanced

Nginx postgres problem

March 04, 2014 10:15AM
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 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.

Can some one throw some light on this issue if I am doing something wrong.

Also is there any supporting module to use the echo statements inside the postgres block.

Thanks,
Arun

Request :
http://localhost/tenantservices/tenantID/service/userID/EndPointName

location ~ ^/tenantservices/(.*)\/(.*)\/(.*)\/(.*)
{
echo teh complete request uri is :$request_uri;
echo The first parameter is :$1;
echo the second aprameter is :$2;

echo the third parameter is :$3;
echo the fourth param is :$4;

set $tenantID $1;
set $serviceName $2;
set $userID $3;
set $endPointName $4;
echo After setting the tenantID:$tenantID;

eval_subrequest_in_memory off;
eval $max_no_clusters
{
default_type 'text/plain';
postgres_pass tenantdatabase;
postgres_escape $tenantURID $tenantID;
postgres_query "SELECT max_no_clusters FROM load_balancer WHERE id=$tenantURID";
postgres_output value ;
}

echo MaxNoOfclusters is : $max_no_clusters;
}

Log message on Nginx:
2014/03/04 15:46:05 [error] 31995#0: *152 postgres: "postgres_output value" received 0 value(s) instead of expected single value in location "/eval_155080700" while processing result from PostgreSQL database,
Subject Author Posted

Nginx postgres problem

arunh March 04, 2014 10:15AM

Re: Nginx postgres problem

Yichun Zhang (agentzh) March 04, 2014 06:20PM

Re: Nginx postgres problem

arunh March 05, 2014 11:39AM

Re: Nginx postgres problem

Yichun Zhang (agentzh) March 05, 2014 03:00PM

Re: Nginx postgres problem

Yichun Zhang (agentzh) March 05, 2014 03:04PM

Re: Nginx postgres problem

arunh March 05, 2014 05:21PM

Re: Nginx postgres problem

Yichun Zhang (agentzh) March 05, 2014 05:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 214
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready