How to use a custom 403 page
December 29, 2013 09:15PM
Wondering if I could get some help. I am unable to serve a custom 403 page.
I am using the geoip module to block a few ip addresses. I need to serve a custom xml file as the 403. My problem is that even tho I have set everything up according to the directions (i think) I still get the default nginx 403 page. Please take a look at my /etc/nginx/sites-enabled/default and let me know what is out of place.

.....
###redirect IP_1
geo $bad_user {
default 0;
bad.ip.1/32 1;
bad.ip.2/32 1;
}

server {

.........

####custom 403 error page for ip block
error_page 403 /error.xml;
location = /error.xml {
root /var/www/static;
allow all;
}

####redirect IP_2
if ($bad_user) {
return 403;
}

I have verified that directories and xml file have the correct permission. I am able to access the error.xml file if I disable the geoip block. Please let me know if you have any thoughts, ideas or what other info I can provide.

Thanks for your help
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 106
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready