Nginx HTML content while redirect

Athlan asked:

When the redirection is configured in nginx, the response contains:

<html>[CRLF]
<head><title>301 Moved Permanently</title></head>[CRLF]
<body bgcolor="white">[CRLF]
<center><h1>301 Moved Permanently</h1></center>[CRLF]
<hr><center>nginx</center>[CRLF]
</body>[CRLF]
</html>[CRLF]

while debugging:

curl -i http://www.domain.com

Can I Hide info about nginx from redirect html’s?

I have jut managed hide info about nginx by setting more_set_headers "Server: ";

My answer:


From a quick glance at the source, I think you should be able to supply your own error_page for 301, 302, 303 and 307.

error_page 301 /301.html;

location = /301.html {
    internal;
}

(Of course, in this example /301.html must exist.)


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.