Welcome! Log In Create A New Profile

Advanced

Help with nginx http auth based on forwarded IP.

Alex Flex
March 16, 2015 10:10PM
> Hello Nginx,
>
> I have these lines:
>
> location / {
> proxy_pass http://172.4.1.2:8080;
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $our_x_forwarded_for;
> satisfy any;
> allow 116.2.200.1;
> auth_basic "protected";
> auth_basic_user_file /var/www/html/.htpasswd;
> }
>
> It works fine when the remote user is not going through a proxy
> ($remote_ip is the real ip).
>
> The problem is I need to allow the user based on the x_forwarded_ip (in
> this case 116.2.200.1) .
>
> How can I achieve this? I know this isnt very secure because anybody
> can emuliate a x_forwarded_ip but this is just an additional layer of
> protection in place.
>
>
> Thanks
>
> Alex.
>
>
>

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

Help with nginx http auth based on forwarded IP.

Alex Flex March 16, 2015 10:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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