reponse 500 content

piotrek84 nginx-forum at
Mon Aug 1 13:42:21 UTC 2016


I have a reverse proxy setup in which nginx serves as load balancer for 2
simmiliar java backends. The java applications are supposed to return a XML
based content. The problem is, that when an error occurs in the java
application, it returns a response with with error code 500 and some XML
payload with stack trace, but nginx doesn't forward the stack trace. It just
returns to the client:

<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>

Is there something I can do to forward the rest of the app response to
client? There is a requirement to do so.

nginx configuration below:

user  nginx;
worker_processes  2;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/;

events {
    worker_connections  1024;

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request"
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;

    keepalive_timeout  65;

    proxy_intercept_errors off;

    include /etc/nginx/sites-enabled/*;

and included file:

upstream upstream-dc {
        server xxx:9001;
        server xxx:9001;
server {
    listen       9001;
    server_name  domain;

    access_log      /var/log/nginx/access-drools.log;
    error_log       /var/log/nginx/error-drools.log;

    location / {
        proxy_pass   http://upstream-dc;
                proxy_set_header  X-Real-IP  $remote_addr;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For
                proxy_redirect off;
                proxy_next_upstream     error timeout invalid_header
                proxy_read_timeout 120;
                proxy_connect_timeout 120;
                proxy_send_timeout 120;
                client_max_body_size 25m;

Posted at Nginx Forum:,268678,268678#msg-268678

More information about the nginx mailing list