Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx allow all doesn't work

I am trying to allow pinterest to access to my dev site's images, currently nginx deny.conf is using auth_basic and a list of allow IPs. There is no deny all in there. satisfy any is also in deny.conf

I added allow allto my site's config and restarted/reloaded nginx but still getting access denied from pinterest.

location ^~ ^/(cache|media|static)/ {
        allow all;
        access_log off;
        expires 1y;
    }

Any ideas?

like image 757
James Lin Avatar asked Oct 19 '25 01:10

James Lin


1 Answers

Try putting satisfy any; in your configuration. That tells Nginx to accept either HTTP authentication or IP restriction. By default, when you define both, it will expect both.

Allows access if all (all) or at least one (any) of the ngx_http_access_module, ngx_http_auth_basic_module, ngx_http_auth_request_module, or ngx_http_auth_jwt_module modules allow access.

Example:

location / {
    satisfy any;

    allow 192.168.1.0/32;
    deny  all;

    auth_basic           "closed site";
    auth_basic_user_file conf/htpasswd;
}

Source

like image 64
mattcooney Avatar answered Oct 21 '25 15:10

mattcooney



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!