Welcome! Log In Create A New Profile


Custom error page for post queries

August 11, 2014 03:39AM

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.

The nginx.conf

upstream rtb {
keepalive 32;
server fail_timeout=0;

server {
server_name rtb.loopme.me;

open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

log_not_found off;
access_log off;
error_log /var/log/nginx/error.log warn;

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

location / {
try_files $uri @rtb;

location @rtb {
access_log /var/log/nginx/rtb.access.log;

proxy_set_header Host $host;
proxy_set_header HTTP_HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header HTTP_X_FORWARDED_PROTO $scheme;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_redirect off;
proxy_max_temp_file_size 0;

proxy_pass http://rtb;

Thanks in advance!
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: 62
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready