Welcome! Log In Create A New Profile

Advanced

nginx deny allow with http inside https encapsulation

Posted by rgrraj 
nginx deny allow with http inside https encapsulation
March 07, 2016 01:16AM
Hi all

We have machine with nginx running on port 80 behind a hardware load balancer which has the ssl binded. Hence https is in load balancer and requests are transfered to nginx on port 80. No access without https.

Nginx is configured with logs with loadbalancer format which ensures source ip is also transfered to nginx and same is getting logged in logs.

We need to apply deny for certain location for certain ip along with allow for rest of the world. But with the following we are unable to achieve the goal. The configuration is as follows,

conf file
location /path/tobloack/ {
deny 1.2.3.4;
deny 5.6.7.8;
allow all;
}

location /path/toblock/ {
deny 1.2.3.4;
deny 5.6.7.8;
allow all;
}

nginx listens on port 80 only.
nginx version: nginx/1.9.2

when we access the page with 443 / https its not blocking the access.
ie : https://webaddress.com/path/toblock/ is not denied when accessing from ip 1.2.3.4.

Can some one help me where we are wrong.

Thanks
Raj
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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