gpt4 book ai didi

json - 启用 mod_deflate 时,Apache 2.4.7 未发送 304 响应

转载 作者:行者123 更新时间:2023-12-04 18:47:35 24 4
gpt4 key购买 nike

我在 Ubuntu Server 14.04 上运行 Apache 2.4.7

我有一个网络服务器正在运行。它返回 304 modified对于图像,但 json 的返回值不同文件。我已经检查了 this post 的答案和评论和 this post ,但是,它们对我不起作用。

在我的 .conf文件,当我不加载 mod_deflate ,服务器返回 304对我的 json 的回应文件。但是当我 GZIP 这个文件时,服务器返回 200 OK .

这是我添加到我的 apache2.conf文件:

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
</IfModule>

启用两个 mod_deflate 的任何解决方法和 304对于 .json文件?

谢谢!

最佳答案

只需在 apache 配置中将 Etag 设置为 NONE。

启用 mod_deflate 会将 -gzip 附加到 Etag,然后该服务器将不接受该服务器。

mod_deflate spec

AddSuffix Append the compression method onto the end of the ETag, causing compressed and uncompressed representatins to have unique ETags. This has been the default since 2.4.0, but prevents serving "HTTP Not Modified" (304) responses to conditional requests for compressed content.

关于json - 启用 mod_deflate 时,Apache 2.4.7 未发送 304 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24039004/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com