Welcome! Log In Create A New Profile

Advanced

Re: limit_except - require trusted ip AND auth vs. ip OR auth

Maxim Dounin
June 19, 2019 08:34AM
Hello!

On Tue, Jun 18, 2019 at 04:41:51PM +0200, Matthias Müller wrote:

> I would like to constrain HTTP access (PUT, POST) to an NGINX server
> for specific locations.
>
> There are two cases:
>
> 1) Permit POST, PUT if the request matches a trusted IP address OR
> Basic auth credentials (either-or)
> 2) Permit POST, PUT if the request matches a trusted IP address AND
> Basic auth credentials (must match both)
>
>
> The configuration for (2) is appended. But how can I achieve (1)? It
> seems that "satisfy any" cannot be included with "limit_except".

While the "satisfy" directive cannot be used in limit_except
blocks, the value set in the enclosing location still applies.
So, you can do something like this:

location /b {
satisfy any;

limit_except GET {
allow 127.0.0.0/8;
auth_basic "closed";
auth_basic_user_file .htpasswd;
}

...
}

This will allow request from specified IP addresses or with
appropriate authentication.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

limit_except - require trusted ip AND auth vs. ip OR auth

Matthias Müller June 18, 2019 10:42AM

Re: limit_except - require trusted ip AND auth vs. ip OR auth

Patrick June 18, 2019 11:04PM

Re: limit_except - require trusted ip AND auth vs. ip OR auth

Patrick June 18, 2019 11:14PM

Re: limit_except - require trusted ip AND auth vs. ip OR auth

Maxim Dounin June 19, 2019 08:34AM

Re: limit_except - require trusted ip AND auth vs. ip OR auth

Matthias Müller June 21, 2019 03:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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