Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

IP deny is skipped when error page filename entered.

$
0
0
I'm using Nginx 1.4.2. In my location block I have:
deny all;
error_page 403 /403.html;
error_page 404 =301 http://www.redirect-domain.com;

In my server block I have:
location /403.html {root /var/test/; internal; allow all;}

Experience: When I visit my domain it gives me the custom 403 error page which is expected because my IP is blocked.

Issue: If i enter the URL of my custom 403 page (http://www.doman.com/403.html) then it bypasses the IP deny and redirects me to http://www.redirect-domain.com as if I am an allowed user. I plan to replace the 'deny all' with a list of bad IPs to prevent them from redirecting but if they enter http://www.doman.com/403.html then the IP block has no effect.

Is this a bug or am I configuring incorrectly? What I am trying to do is: Block all bad IPs with a custom error page. All good IPs are allowed to continue (which is this domain redirects users to my main domain). Everything works fine as long as the bad IP user does not enter the .html file in the url. I can always use a random filename to prevent anyone from guessing the html file but I would like to resolve the issue if possible.

Viewing all articles
Browse latest Browse all 4759

Trending Articles