Redirect request based on request type in case of error

Francis Daly francis at
Wed Jan 10 11:18:50 UTC 2018

On Tue, Jan 09, 2018 at 01:04:22AM -0500, devkuamr wrote:

Hi there,

> I want to redirect GET request to another server in case of errors. I am
> using the below configuration but nginx is having problem while starting
> with this configuration.

>                                 if ($request_method = POST){
>                                         return upstream_status;
>                                 }

> I am getting "invalid return code "upstream_status"" with above
> configuration file.

I don't immediately know about the rest of it, but I suspect there's a
good chance that you want $upstream_status instead of upstream_status.

Francis Daly        francis at

More information about the nginx mailing list