配置mod deflate后,视频无法在Flowplayer中播放

时间:2012-01-23 05:54:02

标签: apache .htaccess flowplayer mod-deflate

我在Windows 7上配置了Apache / 2.2.17服务器,并在.htaccess配置了mod deflate

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \
 \.(?:exe|t?gz|zip|bz2|sit|rar)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

但是一切都运行正常,除了视频没有在Flowplayer中播放,所以我在.htaccess中更改了(从gzip压缩中排除了SWF)到

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \
 \.(?:exe|t?gz|zip|bz2|sit|rar|swf)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

现在视频在除IE之外的所有浏览器中都在流媒体播放。

我也希望在IE中正确配置。

1 个答案:

答案 0 :(得分:0)

以下配置有效      

# force deflate for mangled headers 
# developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$   ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
 </IfModule>
</IfModule>

# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
<IfModule filter_module>
 FilterDeclare   COMPRESS
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
 FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
 FilterChain     COMPRESS
 FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
</IfModule>

 <IfModule !mod_filter.c>
 # Legacy versions of Apache
 AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
  AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml    application/atom+xml
   AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
 </IfModule>
  </IfModule>