Auth user with postgresql

Piotr Sikora piotr.sikora at frickle.com
Fri Feb 17 12:49:28 UTC 2012


Hi,

> Nginx does not ask user and password with the following configuration:

That's because you're returning 403 (Forbidden) instead of 401 
(Unauthorized).

I should update README file, because people get confused by this ;)

> 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"';

You'll also need ngx_headers_more module for this to work:
https://github.com/agentzh/headers-more-nginx-module

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



More information about the nginx mailing list