I have 2 backends in my applications.There are pure backend response example:
First backend: kwfs
yangqingchang@yqc:~$ curl -X GET -I http://192.168.1.118:8080/kwfs/AAChTwAAADcAAwAc
HTTP/1.1 200 OK
Server: QWS/1.0
Content-Type: application/octet-stream
Connection: keep-alive
Cache-Control: max-age=604800
Date: Sun, 09 Oct 2011 13:35:57 GMT
Content-Length: 1239
Second backend: account
yangqingchang@yqc:~$ curl -X GET -I http://192.168.60.99:18000/account/visualconfirm/?page=register
HTTP/1.1 200 OK
Content-Length: 1044
Etag: "f91a3c56177d3edf13a96e0772410d23b531cef5"
Content-Type: image/jpeg
Server: TornadoServer/1.0
After kwfs response across nginx, "Transfer-Encoding: chunked" appeared in it's headers , and "Content-Length" was replaced.
First proxy: kwfs
yangqingchang@yqc:~$ curl -X GET -I http://192.168.60.96:8000/kwfs/AAChTwAAADcAAwAC
HTTP/1.1 200 OK
Date: Sun, 09 Oct 2011 13:58:07 GMT
Content-Type: application/octet-stream
Transfer-Encoding: chunked
Connection: keep-alive
Server: QWS/1.0
Cache-Control: max-age=604800
Second proxy: account
yangqingchang@yqc:~$ curl -X GET -I http://192.168.60.96:8000/account/visualconfirm/?page=register
HTTP/1.1 200 OK
Date: Sun, 09 Oct 2011 13:59:07 GMT
Content-Type: image/jpeg
Connection: keep-alive
Content-Length: 1014
Etag: "bb6c20817a926b5ad761ec7a229f0f6d20adf1cb"
Server: TornadoServer/1.0
I need the "Content-Length" for calculating the downloading process in client.
But I really don't know with same config, why "Content-length" missing when a special response proxy_pass by nginx, and another is ok.
Could anybody tell me why? Thanks a lot :)
My config:
server {
listen 192.168.60.96:8000;
client_max_body_size 2M;
location /kwfs {
proxy_redirect off;
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.1.118:8080;
}
location /account {
proxy_redirect off;
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.60.99:18000;
}
}
My nginx :
nginx -V
nginx version: nginx/0.7.65
built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx-0.7.65 --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module --with-http_realip_module --with-openssl=/home/yangqingchang/Downloads/openssl-0.9.8l --with-pcre=/home/yangqingchang/Downloads/pcre-8.01 --add-module=/home/yangqingchang/Downloads/nginx_upload_module-2.0.12