Welcome! Log In Create A New Profile

Advanced

Re: Custom error page for post queries

Maxim Dounin
August 11, 2014 06:28AM
Hello!

On Mon, Aug 11, 2014 at 03:39:40AM -0400, Keferoff wrote:

> Hi!
>
> Current infrastructure:
> We have nginx/1.7.1 as frontend for java application. We have special
> requirement, when java app goes down we need response with 204 error code
> instead 500 or 502 and this works like in charm for GET queries but nit for
> POST.
>
> The question:
> How I need ti change my config for POST queries.

[...]

> error_page 502 500 =204 @maintenance;
> location @maintenance {
> try_files $uri $uri/ /204/204.html =204;
> }

The problem is that your config tries to use the /204/204.html
file, and this will generate 405 error for POSTs, as static files
doesn't suppport POSTs into them.

(Additionally, trying to use files here doesn't make sense, as 204
responses doesn't return entities.)

Use something like:

error_page 502 = /204;

location = /204 {
return 204;
}

instead.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Custom error page for post queries

Keferoff August 11, 2014 03:39AM

Re: Custom error page for post queries

Maxim Dounin August 11, 2014 06:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 245
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready