Welcome! Log In Create A New Profile

Advanced

Rewrite rules, for Zope, small problem with authentication user

Giuseppe Tofoni
March 21, 2012 12:58PM
Hi, List

I would use Nginx with Zope, but with the following configuration I
can not authenticate the user (from Nginx), otherwise works properly.
Where am I doing wrong?

........
upstream database
{
postgres_server 172.16.65.1 dbname=dbname user=username password=pwd;
}

upstream zope
{
server 172.16.65.1:80;
}

server
{
listen 80;
server_name www.myhostname.com;
rewrite ^/(.*)
/VirtualHostBase/http/www.myhostname.com/www/VirtualHostRoot/$1 last;
index index.htm index.html index_html;

location =/auth
{
internal;
more_set_headers -s 401 'WWW-Authenticate: Basic
realm="$auth_user"';
postgres_escape $user $remote_user;
postgres_escape $pass $remote_passwd;
postgres_pass database;
postgres_query "SELECT user FROM usertable WHERE
user=$user AND pwd=crypt($pass, pwd) $private";
postgres_rewrite no_rows 401;
postgres_output none;
}

# For registered users in DB
location /news/
{
set $auth_user "News";
set $private "and reserve ='S'";
auth_request /auth;
}

location /
{
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://zope;
}

error_page 405 /error/405.htm;
error_page 404 /error/404.htm;
error_page 403 /error/403.htm;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /error/50x.html;
}
..........

Thanks in advance
Giuseppe

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite rules, for Zope, small problem with authentication user

Giuseppe Tofoni March 21, 2012 12:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 156
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