Welcome! Log In Create A New Profile

Advanced

Re: nginx auth_basic with proxy pass to tomcat

Francis Daly
November 08, 2012 08:42AM
On Thu, Nov 08, 2012 at 11:04:39AM +1100, Tharanga Abeyseela wrote:

Hi there,

> thanks for the reply. actually it inside the server block :-) ,

Good to hear.

> i managed to resolve the issue using a rewrite rule as follows
>
> location /demo/ {
> auth_basic "Restricted";
> auth_basic_user_file /var/www/demo/.htpass;
> error_page 404 = @redirect;
> # rewrite ^/demo/(.*)$ http://x.x.x.x/$1 permanent;
> }
>
> location @redirect {
> rewrite ^/demo/(.*)$ http://x.x.x.x/$1 permanent;
> }

That seems very complicated.

I'm a bit unclear on what issue this configuration resolves. It looks
to me like it will (a) insist that anyone accessing things below /demo/
are challenged for credentials; and (b) allow anyone access to anything
other than /demo/ without providing credentials.

Can you describe what it is that you want, and what it is that you do
not want? I'm not sure whether the x.x.x.x above is "this server" or
"some other server"; and I'm not sure what happened to "/next" from the
original configuration.

> is it possible to enable nginx authentication before proxy_pass to tomcat ?

Yes. Put the "auth_basic" in the same location as the "proxy_pass".

If that doesn't do what you want, then I'm afraid that I don't understand
what it is that you want.

f
--
Francis Daly francis@daoine.org

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

nginx auth_basic with proxy pass to tomcat

Tharanga Abeyseela November 06, 2012 08:44PM

Re: nginx auth_basic with proxy pass to tomcat

David J November 06, 2012 08:48PM

Re: nginx auth_basic with proxy pass to tomcat

Tharanga Abeyseela November 06, 2012 08:54PM

Re: nginx auth_basic with proxy pass to tomcat

Francis Daly November 07, 2012 04:02AM

Re: nginx auth_basic with proxy pass to tomcat

Tharanga Abeyseela November 07, 2012 07:06PM

Re: nginx auth_basic with proxy pass to tomcat

Francis Daly November 08, 2012 08:42AM

Re: nginx auth_basic with proxy pass to tomcat

Tharanga Abeyseela November 08, 2012 06:08PM

Re: nginx auth_basic with proxy pass to tomcat

Sergey Budnevitch November 07, 2012 05:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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