现在的位置: 首页 > 综合 > 正文

关于nginx的Transfer-Encoding: chunked

2013年01月07日 ⁄ 综合 ⁄ 共 445字 ⁄ 字号 评论关闭

nginx默认提供php网页的时候   Transfer-Encoding: chunked 导致如果自己需要抓数据来用的 时候解码很麻烦。

 解决这个问题,只需要禁止 nginx 进行多余的 chunked 过程。经查,可以在 nginx 配置文件中相应网站的 location 段中加一行“chunked_transfer_encoding off;”。

  1. location / {
  2.         proxy_pass              http://10.0.0.10/;
  3.         proxy_redirect          off;
  4.         proxy_set_header        Host            $http_host;
  5.         proxy_set_header        X-Real-IP       $remote_addr;
  6.         proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  7.         chunked_transfer_encoding       off;
  8. }

抱歉!评论已关闭.