Welcome! Log In Create A New Profile

Advanced

[Help] Custom error_page is not working. Why?

Posted by errorpage 
[Help] Custom error_page is not working. Why?
August 08, 2017 08:47PM
I'm using latest nginx(sid) on Debian, and my nginx server's config is like this:

server {
server_....
error_page 400 401 403 404 405 408 500 502 503 504 /_an_error_page_.html;

... (misc 403 rules, such as: "if ($blah != 1){return 403;}") ...

location /_an_error_page_.html {internal;allow all;}
location /robots.txt {allow all;}
}

When I connect to https://my.website/ with bad browser/IP/whatever, nginx return 403 as expected
but it return "403 Forbidden - nginx"(generic error).

> "GET / HTTP/1.1" 403 320 "-" "curl/X"

And when I changed "error_page" line to(added =200):

> error_page 400 401 403 404 405 408 500 502 503 504 =200 /_an_error_page_.html;

It just return empty string(0 byte).

> "GET / HTTP/1.1" 200 0 "-" "curl/X"

Of course I reloaded nginx after modified my config file.
Why this is not working, and what I should do to make this work?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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