On Saturday 18 April 2015 11:23:54 jb wrote:
> gotcha, I saw the discarded body thing in the debug log. ok thanks,
> um, how do you proxy_pass to nginx itself ?
> 
> can you give an example ?
> just proxy_pass http://127.0.0.1/
> and proxy_pass_request_body off
> 
> what about my return 200 "$content_length bytes" line still keep that?
> 
[..]

events {}

http {
   log_format  lengths  $request_length;

   server {
       location / {
           proxy_pass http://unix:nginx.sock:;
           proxy_pass_request_body off;

           proxy_set_header X-Response "$content_length bytes";
           proxy_set_header Content-Length "";

           access_log  logs/lengths.log  lengths;
       }
   }

   server {
       listen unix:nginx.sock;
       return 200 $http_x_response;
   }
}

% telnet 127.0.0.1 8000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
POST / HTTP/1.0
Content-Length: 1000

bbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbb 
bbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbb
^]
telnet> close
Connection closed.
% cat logs/lengths.log      
145

--
wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to