nginx http auth module query

karanj nginx-forum at nginx.us
Fri Feb 17 13:30:33 UTC 2012


It doesn't work for me. 

I have 3 files running under HipHop -
1) /tf/test.php - This file sets the session variable -
$_SESSION['X-ErrorPage']='/tf2/test.php';
and then sends header("HTTP/1.1 401 Unauthorized");
2) /tf2/test2.php - This prints "It works"
3) /tf2/test.php - This prints "Error Page"

My config looks like this -
The output on running http://112.11.23.221:8080/tf2/test2.php should be
- "Error Page". But this is not happening.

The nginx error logs shows the following -

2012/02/17 18:52:45 [error] 10103#0: *4 the rewritten URI has a zero
length, client: 122.179.93.88, server: 112.11.23.221, request: "GET
/tf2/test2.php HTTP/1.1", host: "112.11.23.221:8080"

server {
        listen       8080;
        server_name  112.11.23.221;

        location / {
                auth_request /tf/test.php;
                proxy_pass      http://127.0.0.1:4247;
                error_page  401 = /40x.html;
        }
        location /tf/test.php{
                proxy_pass      http://127.0.0.1:4247;
        }

        location = /40x.html {
                auth_request_set $err $upstream_http_x_errorpage;
                rewrite /40x.html $err;
                proxy_pass      http://127.0.0.1:4247;
        }
    }

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,222520,222552#msg-222552



More information about the nginx mailing list