2017-05-02 21 views
0

我在这一刻有什么。如何从httpd-deflate.conf中不存在的图像中删除gzip编码?

在的httpd-deflate.conf在位置部分:

SetEnvIfNoCase Request_URI \ 
\\.(?:gif|jpe?g|jpg|png|rar|zip|exe|flv|swf|mov|wma|mp3|mp4|avi|mp?g)$ no-gzip dont-vary 

在.htaccess: - 无需gzip编码

Options +FollowSymlinks 

RewriteBase/

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d 

RewriteCond %{REQUEST_URI} !^/index\.php$ [NC] 

RewriteRule ^(.+)$ /index.php?_route_=$1 [L,QSA] 

与实际是在服务器上的这些设置的图像根据需要被处理并且在服务器响应中没有“Content-Encoding:gzip”头文件。

但在index.php文件中处理不存在的图像。 http://example.com/nonexistent-path/non-existent-image.jpg 响应正文:

Cache-Control: max-age=84148768 

Connection: keep-alive 

Content-Encoding: gzip 

Content-Length: 49860 

Content-Type: image/jpeg - ((I set it in php manually after image generation before output)) 

Date: Mon, 01 May 2017 22:04:48 GMT 

Expires: Tue, 31 Dec 2019 20:44:16 GMT 

Last-Modified: Thu, 17 Nov 2016 14:51:10 GMT 

Server: nginx 

Strict-Transport-Security: max-age=2592000 

Vary: Accept-Encoding 

X-XSS-Protection: 1; mode=block 

x-content-type-options nosniff 

正如你看到的这个不存在的图像处理为一个文件,而不是为.jpg图像。

在服务器上我有Apache和nginx代理,据我所知。我应该在httpd-deflate.conf或其他任何地方粘贴什么内容来删除不存在的图像的gzip编码,并删除服务器响应中的“Content-Encoding:gzip”?

谢谢。

回答

0

使用

apache_setenv('no-gzip', '1'); 
在你的PHP脚本

输出之前。