问题:
http接口,输出Json
代码迁移服务器,原来的服务器接口消息头输出如下:
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: Keep-Alive
Content-Type: text/html
Date: Sun, 02 Jun 2019 17:04:02 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=5, max=100
Pragma: no-cache
Server: Apache
**Transfer-Encoding: chunked**
X-Powered-By: PHP/5.5.38
新服务器自己装的LAMP环境,配置apache2,调用同一个接口,消息头返回如下:
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: close
**Content-Length: 5**
Content-Type: text/html
Date: Mon, 03 Jun 2019 15:47:39 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Proxy-Connection: keep-alive
Server: Apache
客户端写了chunked输出的解析不好升级,所以希望新服务器配置后,保持与原服务器一样的chunked输出.
Apache版本:
iZm5ecq1dcb6zw7pexhdp5Z:/etc/apache2 # apache2ctl -v
Server version: Apache/2.4.23 (Linux/SUSE)
Server built: 2017-12-28 13:20:25.000000000 +0000
设置加载模块:
iZm5ecq1dcb6zw7pexhdp5Z:/etc/apache2 # /usr/sbin/apachectl -t -D DUMP_MODULES
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_prefork_module (static)
unixd_module (static)
systemd_module (static)
authz_host_module (shared)
actions_module (shared)
alias_module (shared)
authn_file_module (shared)
auth_basic_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
dir_module (shared)
include_module (shared)
log_config_module (shared)
mime_module (shared)
negotiation_module (shared)
setenvif_module (shared)
status_module (shared)
userdir_module (shared)
asis_module (shared)
imagemap_module (shared)
php5_module (shared)
version_module (shared)
authn_core_module (shared)
reqtimeout_module (shared)
authz_core_module (shared)
socache_shmcb_module (shared)
deflate_module (shared)
filter_module (shared)
headers_module (shared)
客户端请求:
GET /device_auth.php?deviceid=xxxxxxxxx HTTP/1.1
Host:www.xxxxx.tech
1、尝试注释掉server-tuning.conf配置文件中的涉及的downgrade-1.0行,重启apace服务,接口没有改变
2、尝试用curl在客户端添加header指定Accept-Encoding: gzip之后,可以得到Server返回Transfer-Encoding: chunked
请问
是否遗漏了什么设置,如何修改配置才能使接口默认返回chunked消息头?
我猜测是因为没开启
apache
中的KeepAlive
,参考一下apache
社区中的这篇回答,链接描述