gplessis/dotdeb-nginx

[Feature Request] Nginx Real-IP

Closed this issue · 7 comments

Is there any chance to get the real-ip module implemented? It's very usefull if you're using a reverse proxy like cloudflare.

Already included in all nginx flavors.

So why im getting this error?
2015/04/22 15:29:07 [emerg] 11413#0: unknown directive "set_real_ip_from  " in /etc/nginx/sites-enabled/default:6

It's strange, because it's enabled in the default config : https://github.com/gplessis/dotdeb-nginx/blob/wheezy/debian/rules

Could you please paste the result of dpkg -l 'nginx*'?

I have the exact same config/version with nginx-full :

http {
...
        set_real_ip_from 10.0.0.0/8;
        real_ip_header X-Forwarded-For;
...
}

And it works. Could you please check that you don't have a typo in your config files?

I've put this into the server config.

server {
    (...)
        set_real_ip_from   204.93.240.0/24;
        set_real_ip_from   204.93.177.0/24;
        set_real_ip_from   199.27.128.0/21;
        set_real_ip_from   173.245.48.0/20;
        set_real_ip_from   103.21.244.0/22;
        set_real_ip_from   103.22.200.0/22;
        set_real_ip_from   103.31.4.0/22;
        set_real_ip_from   141.101.64.0/18;
        set_real_ip_from   108.162.192.0/18;
        set_real_ip_from   190.93.240.0/20;
        set_real_ip_from   188.114.96.0/20; 
        set_real_ip_from   197.234.240.0/22;
        set_real_ip_from   198.41.128.0/17;
        set_real_ip_from   2400:cb00::/32;
        set_real_ip_from   2606:4700::/32;
        set_real_ip_from   2803:f800::/32;
        set_real_ip_from   2405:b500::/32;
        set_real_ip_from   2405:8100::/32;
        real_ip_header     CF-Connecting-IP;
    (...)
}

The error-log says it's in line 6, in this case its the first "set_real_ip_from" directive.
Edit: Same in the http { } configuration

Okay! IT WAS A F*** WHITESPACE!
Thanks nginx 👎