Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1514 closed defect (invalid)

ngx_http_mirror_module does not send body

Reported by: dmitrijkir@… Owned by:
Priority: minor Milestone: 1.13
Component: other Version: 1.13.x
Keywords: Cc:
uname -a: Linux 885a0a7f36ed 4.13.0-37-generic #42-Ubuntu SMP Wed Mar 7 14:13:23 UTC 2018 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.13.10
built by gcc 6.3.0 20170516 (Debian 6.3.0-18)
built with OpenSSL 1.1.0f 25 May 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.13.10/debian/debuild-base/nginx-1.13.10=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

Description

my nginx conf:

server {
    listen 80;
    server_name localhost;


    location / {
        mirror /mirror;
	mirror_request_body on;
        proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        if (!-f $request_filename) {
            proxy_pass http://172.17.0.1:8081;
            break;
        }

    }

    location /mirror {
        internal;
	proxy_pass_request_body on;
        proxy_pass http://172.17.0.1:5000/api/mirror/request/;
        proxy_set_header Content-Length "";
        proxy_set_header HOST $http_host;
        proxy_set_header X-Original-URI $request_uri;
        proxy_set_header X-SERVER-PORT $server_port;
        proxy_set_header X-SERVER-ADDR $server_addr;
        proxy_set_header X-REAL-IP  $remote_addr;
        proxy_set_header X-Request-ID $request_id;
    }

}

I receive everything except the body of the request.
On the main address the body of the request comes.

Change History (2)

comment:1 by Maxim Dounin, 7 years ago

Resolution: invalid
Status: newclosed

In your configuration, you've cleared the Content-Length header with proxy_set_header Content-Length "";. The resulting request will be invalid (with body, but without Content-Length specified), and your backend won't be able to read the request body. Fixing your configuration will resolve this.

comment:2 by dmitrijkir@…, 7 years ago

Thank you so much

Note: See TracTickets for help on using tickets.