So, when doing curl -i http://example.com
on my server, I get this response in body:
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
It shows that I'm running nginx and I'd like to remove this information.
Here's my nginx.conf redirect to HTTPS (together with my try to change 301 response body):
server {
listen 80;
server_name localhost;
error_page 301 = /301.html;
location /301.html {
return 301 "<h1>use https</h1>";
}
return 301 https://$host$request_uri;
}
Any idea how to change 301 response body?
Best Answer
There's a great post about custom error pages at the following URL. The following is an abbreviated version of how it can be used to remove nginx branding from the
301
and302
HTTP responses.nginx.conf
/error.html