小编Wil*_*iss的帖子

在 Apache 中启用 gzip 压缩时未发送内容长度?

我真的很感激能帮助理解这种 Apache 行为。

我正在从应用程序/json 中的 iPhone Objective-C 应用程序与 PHP 通信。Gzip 压缩在服务器上启用,并由客户端请求。

从我的.htaccess:

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php application/json
Run Code Online (Sandbox Code Playgroud)

对于小型请求,Apache 正在设置“Content-Length”标头。例如(这些值在 Objective-C 中从标头输出):

Connection = "Keep-Alive";
"Content-Encoding" = gzip;
"Content-Length" = 185;     <-------------
"Content-Type" = "application/json";
Date = "Wed, 22 Sep 2010 12:20:27 GMT";
"Keep-Alive" = "timeout=3, max=149";
Server = Apache;
Vary = "Accept-Encoding";
"X-Powered-By" = "PHP/5.2.13";
"X-Uncompressed-Content-Length" = 217;
Run Code Online (Sandbox Code Playgroud)

X-Uncompressed-Content-Length是我添加的标头,设置为未压缩 JSON 字符串的大小。

如您所见,此请求非常小(217 字节)。

这是来自较大请求(282888 字节)的标头:

Connection = "Keep-Alive";
"Content-Encoding" = gzip;
"Content-Type" = "application/json";
Date = "Wed, …
Run Code Online (Sandbox Code Playgroud)

php compression gzip apache-2.2

14
推荐指数
3
解决办法
4万
查看次数

使用 Apache,是否可以为非文件夹 URL 生成目录列表?

如果您访问没有 index.html 的文件夹,Apache 允许您创建目录列表(配置后)。

我想知道的是,是否可以在不同的 URL 处获得相同的列表?我已经在使用 index.html 并希望保持这种状态

即,这就是我要找的:

http://example.com/blar/-> 加载我的 index.html 页面(不想改变) http://example.com/blar/directory_list(我希望这个 url 来呈现 apache 目录列表)

directoryindex apache-2.2

1
推荐指数
1
解决办法
965
查看次数

标签 统计

apache-2.2 ×2

compression ×1

directoryindex ×1

gzip ×1

php ×1