Hi
I'm running into a problem where requests for 403, get caught in a redirect loop and eventually fail with a 500 response.
I want to return custom 403 page for requests from germany.
###Config###
pid /var/run/nginx/nginx.pid;
user nginx nginx;
worker_processes 4;
worker_rlimit_nofile 30000;
events {
worker_connections 4028;
use epoll;
}
http {
geoip_country /usr/share/GeoIP/GeoIP.dat;
geo $Default {
default 0;
#skip this ip from getting 403
12.32.32.32 1;
}
## Size Limits
client_body_buffer_size 128K;
client_header_buffer_size 1M;
client_max_body_size 1M;
large_client_header_buffers 8 8k;
## Timeouts
client_body_timeout 60;
client_header_timeout 60;
expires 12h;
keepalive_timeout 60 60;
send_timeout 30;
## General Options
ignore_invalid_headers on;
keepalive_requests 50;
recursive_error_pages on;
sendfile on;
server_name_in_redirect off;
server_tokens off;
upstream www.abcd.com {
server www.abcd.com:443 ;
}
server {
listen 12.23.34.45:80;
server_name www.abcd.com;
access_log /var/log/nginx/www.abcd.com/access.log main;
error_log /var/log/nginx/www.abcd.com/error.log;
if ($geoip_country_code = 'DE' ) {
set $value "${Default}I";
}
if ($value = 0I){
return 403;
}
error_page 403 /e403.html;
location /e403.html {
root /var/www/html/maintenance;
internal;
}
## PROXY - Web
location / {
rewrite ^(.*) https://www.abcd.com$1 permanent;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
#### End Config ####
#### Error log #####
2011/07/28 09:25:10 [error] 20282#0: *242010 rewrite or internal redirection cycle while internal redirect to "/e403.html", client: 122.248.163.3, server: www.abcd.com, request: "GET /favicon.ico HTTP/1.1", host: "www.abcd.com"
#### End Log ######
Location of e403.html /var/www/html/maintenance
Can someone please help me figure out the issue here.