Forcing a Basic Dialog Box.

Piotr Sikora piotr.sikora at frickle.com
Mon Jan 2 04:13:16 UTC 2012


Hi,
diff inline.

Please note that you'll also need ngx_headers_more module:
https://github.com/agentzh/headers-more-nginx-module

> location / {
>          auth_basic "Restricted";

-auth_basic "Restricted";

>          root        /var/www/web/;
>          auth_request      /auth;
> 
>          try_files $uri $uri/ @upstream;
>      }
> 
> 
>   location /auth {

-location /auth {
+location = /auth {

>              internal;
> 
>              postgres_escape   $user $remote_user;
>              postgres_escape   $pass $remote_passwd;
> 
>              postgres_pass     database;
>              postgres_query    "SELECT login FROM users WHERE 
> login=$user AND pass=$pass";
>              postgres_rewrite  no_rows 403;

-postgres_rewrite  no_rows 403;
+postgres_rewrite  no_rows 401;
+more_set_headers -s 401 'WWW-Authenticate: Basic realm="Restricted"';

>              postgres_output   none;
>          }

Best regards,
Piotr Sikora < piotr.sikora at frickle.com >



More information about the nginx mailing list