forced 404 without a location display ?
Jonathan Vanasco
nginx at 2xlp.com
Mon Jul 11 19:26:30 UTC 2016
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>
More information about the nginx
mailing list