forced 404 without a location display ?
Maxim Dounin
mdounin at mdounin.ru
Mon Jul 11 20:27:57 UTC 2016
Hello!
On Mon, Jul 11, 2016 at 03:26:30PM -0400, Jonathan Vanasco wrote:
> I have some servers where I use an old method of gating a path
> by using a file check.
>
> this allows staff to turn off certain locations during
> migrations/updates without having root privileges (needed to
> restart nginx)
>
> an issue I noticed– this method now (perhaps always) shows the
> name of the location on the default 404 template [the response
> that nginx generates via code, not a template on the fs]
>
> Does anyone know how to disable showing the location without
> defining a custom template on the filesystem? or perhaps
> someone can think of a better way to accomplish my goals?
>
>
>
> location /paths/to/ {
> if (!-f /etc/nginx/_flags/is_running) {
> rewrite ^.*$ @is_running break;
> }
> }
> location = @is_running {
> return 404;
> }
>
> =======
> that generates this
>
>
> <html>
> <head>
> <title>404 Not Found</title>
> </head>
> <body>
> <h1>404 Not Found</h1>
> The resource could not be found.<br/><br/>
> /@is_running
>
>
> </body>
> </html>
This is not something nginx generates.
An nginx-generated error will look like:
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.11.3</center>
</body>
</html>
No location information is added by nginx to error pages, and
never was. You are probably using something with 3rd party
patches. An obvious fix is to switch to using vanilla nginx
instead, it can be downloaded here:
http://nginx.org/en/download.html
--
Maxim Dounin
http://nginx.org/
More information about the nginx
mailing list