1

I cannot seem to get Nginx basic auth working from behind a Rackspace cloud balancer.

First I am using this code (it is also using real IP module here which was one of the mannny solutions I tried) within my nginx.conf:

http {
    set_real_ip_from 1.1.1.2;
    #real_ip_header    X-Forwarded-For;

    satisfy any;
    allow 1.1.1.2;
    deny all;
    auth_basic "Restricted";
    auth_basic_user_file /etc/nginx/htpasswd;

And this is the fields I see in my header within PHP:

["HTTP_X_FORWARDED_FOR"]=> string(14) "1.1.1.2"

And for some reason Nginx does not work on that by default.

I have tried quite a things but I cannot seem to get it to work.

Any ideas?

Sammaye
  • 719
  • 1
  • 8
  • 16

1 Answers1

2

Just as I ask I actually find out why it is not working:

set_real_ip_from

Says a list of IPs from which you trust the IP to set from, so I needed to put my load balancer IP into there and comment out the next line and now everything works.

Sammaye
  • 719
  • 1
  • 8
  • 16