Welcome! Log In Create A New Profile

Advanced

Re: nginx http auth module query

Maxim Dounin
February 17, 2012 09:20AM
Hello!

On Fri, Feb 17, 2012 at 08:30:33AM -0500, karanj wrote:

> 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;
> }
> }

You have to use auth_request_set in the same location with
auth_request directive.

location / {
auth_request /tf/test.php;
auth_request_set $err $upstream_http_x_errorpage;
...
}

...

Maxim Dounin

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

nginx http auth module query

karanj February 16, 2012 10:49PM

Re: nginx http auth module query

António P. P. Almeida February 16, 2012 11:02PM

Re: nginx http auth module query

karanj February 16, 2012 11:08PM

Re: nginx http auth module query

António P. P. Almeida February 16, 2012 11:30PM

Re: nginx http auth module query

karanj February 17, 2012 03:53AM

Re: nginx http auth module query

karanj February 17, 2012 03:57AM

Re: nginx http auth module query

Maxim Dounin February 17, 2012 06:28AM

Re: nginx http auth module query

karanj February 17, 2012 08:30AM

Re: nginx http auth module query

karanj February 17, 2012 08:38AM

Re: nginx http auth module query

Maxim Dounin February 17, 2012 09:20AM

Re: nginx http auth module query

karanj February 17, 2012 10:31AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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