forced 404 without a location display ?

Jonathan Vanasco nginx at 2xlp.com
Tue Jul 12 22:45:21 UTC 2016


On Jul 11, 2016, at 4:27 PM, Maxim Dounin wrote:
> 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:

On Jul 11, 2016, at 4:25 PM, Oleg A. Mamontov wrote:

> =============================================
> location /paths/to/ {
>    if ( !-f /etc/nginx/_flags/is_running ) {
>        rewrite ^ /is_running last;
>    }
> }
> location = /is_running {
>    internal;
>    return 404 'nothing\n';
> }
> =============================================



Thanks to you both!

I spent way more time than I should tracking the issue.  I finally figured it out.  Details below:

1. I am using a non-standard nginx -- I run openresty.  I thought this might have been the issue so started creating test-cases to pin down, and running against all the nginx & openresty versions. I could not consistently get this to repeat.

2. The first part of the problem is that I had `break` on my rewrite, instead of `last`.

3. The second part of my problem, and this is where the confusion happened -- a proxypass was involved

Using `last`:
	what i wanted happened

Using `break`
	the rewrite to `/is_running` got passed to the proxypass; the application was creating the error message
	the app's error message template was very similar to nginx -- and that threw me off
	i only figured this out, because nginx served an error when the application was taken offline during an update






More information about the nginx mailing list