标签: http-compression

mod_deflate或mod_gzip,应该使用?

mod_deflate或者mod_gzip,应该使用哪个?

我读mod_gzip了更好的解释,但想知道额外的mod_deflate.

compression apache http-compression

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

IE在IIS7中打开脚本,打开静态压缩

我遇到的问题是,在IIS7中没有解压缩的javascript文件和样式表没有正确加载.

我可以通过关闭IIS中的静态压缩来解决此问题,但这不是一个永久的解决方案.这个问题突然开始发生了.我们没有改变代码.

Web应用程序是.net 4中的asp.net Web表单应用程序.在IIS中设置了静态和动态压缩.另一个Web表单Web应用程序仍在运行正常,在应用程序级别设置静态压缩.

服务器已更新为.net 4.5框架.

一些样式表标签被设置为runat服务器,因为我附加了一个版本号,以便在缓存和新版本发布时强制重新加载css.

此问题仅在Internet Explorer中发生.

我真的陷入了这个问题.

请求

Request GET        /webapp/JavaScript/jQuery/js/jquery-1.3.2.min.js HTTP/1.1
Accept  text/html, application/xhtml+xml, */*
Accept-Language x-en-GB-zscot
User-Agent  Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
UA-CPU  AMD64
Accept-Encoding gzip, deflate
Host    localhost
Connection  Keep-Alive
Run Code Online (Sandbox Code Playgroud)

响应标题

Key Value
Response    HTTP/1.1 200 OK
Cache-Control   private
Content-Type    application/x-javascript
Content-Encoding    gzip,gzip
Last-Modified   Wed, 10 Oct 2012 15:45:44 GMT
Accept-Ranges   bytes
ETag    "04f24efea6cd1:0"
Vary    Accept-Encoding
Server  Microsoft-IIS/7.5
X-Compressed-By HttpCompress
Date    Tue, 04 Dec 2012 11:07:13 GMT
Content-Length …
Run Code Online (Sandbox Code Playgroud)

asp.net internet-explorer iis-7 http-compression .net-4.5

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

为什么Chrome会提示在超链接上将页面下载为.gz文件,但我不会手动输入URL?

我刚刚在Chrome上尝试访问某些页面时发现了一种非常奇怪的行为.它会提示将它们下载为.gz文件而不是加载它们.

这仅适用于当前的Chrome和所有平台.

正确加载页面后,我可以在Inspector上看到这一点

Resource interpreted as Document but transferred with MIME type application/x-gzip:" https://confluence.example.com/display/engp/PR-1221 ".

我知道这些是由配置为使用gzip压缩的nginx服务器提供的,但这没有任何问题.

  gzip  on;  # that's on nginx part
Run Code Online (Sandbox Code Playgroud)

我几乎可以肯定这是nginx配置有问题,但是什么?

是什么让这个问题更加有趣(而且很烦人)是,如果您从超链接复制URL并将其粘贴到浏览器,它将只是正确地打开页面.是的,这只发生在超链接上.

我试图在此找到有关chrome的错误报告,但我唯一能找到的是其他人确实报告了与reddit页面或类似问题相似的问题github.com.

Request URL:https://confluence.example.com/display/engp/PR-1221
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:UTF-8,*;q=0.5
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
DNT:1
Host:example.com
Referer:https://example.com/browse/PR-1221
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22
Run Code Online (Sandbox Code Playgroud)
Response Headersview source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type
Access-Control-Allow-Methods:GET, POST, OPTIONS, HEAD
Access-Control-Allow-Origin:*
Baz:bah
Cache-Control:no-cache, must-revalidate
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html;charset=UTF-8
Date:Mon, 04 …

gzip google-chrome http-compression

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

用于内容编码的"x-gzip"和"gzip"之间的差异

在请求标头中,我们有accept-encoding: gzip,但得到了编码响应x-gzip.

我发现了关于x-gzip和gzip的这个注释:

不希望使用程序名来识别编码格式,并且不鼓励将来编码.它们在这里的使用代表了历史实践,而不是良好的设计.为了与以前的HTTP实现兼容,应用程序应该认为"x-gzip"和"x-compress"分别等同于"gzip"和"compress".

它的意思x-gzip是等于gzip吗?我们可以简单地使用相同的方式将x-gzip内容解压缩为gzip内容?

networking encoding http-compression

6
推荐指数
2
解决办法
7624
查看次数

为什么压缩ScriptResource.axd,即使禁用了IIS压缩?

我在IIS 6.0上运行ASP.NET应用程序.通常我为动态和静态文件打开了压缩.但是,我暂时关闭了压缩,但"ScriptResource.axd"仍然被压缩.这不像是一个错误的配置,因为"WebResource.axd"没有被压缩.

ScriptResource和WebResource有什么区别,前者仍然被压缩了?怎么压缩?

谢谢.

asp.net iis gzip http-compression

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

没有服务器支持的gzip?

我编写了一个CSS服务器,它实现了最小化和基本解析/ var替换.服务器正在使用node.js.

我想从这台服务器gzip我的回复.正如在IRC中所说的那样,node.js当前没有gzip lib,所以我试图从命令行手动完成它(因为我不在缓存中时只是gzip).

我将文件数据推送到临时文件,然后使用exec调用'gzip -c -9 -q ' + tempFile.我正确地恢复了压缩数据(似乎),然后发送正确的Content-Encoding标题'gzip',但Chrome报告:

Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.

此外,一些独立的gzip测试人员在线也失败了(不仅仅是Chrome).

我假设这是一个简单的事情,我不知道为浏览器生成gzip块,因为我从未尝试过手动操作.

任何帮助都会有所帮助.服务器速度非常快,但我需要对内容进行gzip以获得最终用户的最佳性能.

谢谢.

更新 我已经证实我Content-Length是对的

compression gzip http http-compression node.js

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

Azure网站上的HTTP 1.0代理请求的gzip压缩

有没有办法让Azure网站为来自像Amazon Web Services CloudFront这样的HTTP 1.0代理的请求提供gzip的内容?考虑这样的请求:

curl -I -H "accept-encoding: gzip,deflate,sdch" -H "Via: 1.0 {foo.cdn.net}" -0 http://{fooproject}.azurewebsites.net/
Run Code Online (Sandbox Code Playgroud)

似乎要完成的一般方法是将以下元素添加到system.webServer:

<httpCompression noCompressionForHttp10="false" noCompressionForProxies="false" />
Run Code Online (Sandbox Code Playgroud)

它似乎httpCompression有效,ApplicationHost.config而不是web.config在Azure网站上不可覆盖.

有关解决方法的任何建议吗?

其他资源:

asp.net iis http-compression azure azure-web-sites

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

用于CSS的Tomcat8 Gzip压缩,JS

我正在使用tomcat8并试图模拟CSS和JS的GZIP压缩.我在server.xml中添加了条目,然后是

 <Connector port="8088" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" compression="on"
     compressionMinSize="2048"
     noCompressionUserAgents="gozilla, traviata"
     compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json" />
Run Code Online (Sandbox Code Playgroud)

在我的html页面中,我已经包含了如下脚本

<script type="text/javascript" src="extjs/ext-all-debug.js"></script> 
Run Code Online (Sandbox Code Playgroud)

但是在访问页面时,压缩没有发生,并且resposne header收到如下.

Remote Address:[::1]:8088
Request URL:http://localhost:8088/test/extjs/ext-all-debug.js
Request Method:GET
Status Code:200 OK
Run Code Online (Sandbox Code Playgroud)

响应标题

view source
Accept-Ranges:bytes
Content-Length:4585183
Content-Type:application/javascript
Date:Wed, 03 Jun 2015 00:34:12 GMT
ETag:W/"4585183-1427778288000"
Last-Modified:Tue, 31 Mar 2015 05:04:48 GMT
Server:Apache-Coyote/1.1
Run Code Online (Sandbox Code Playgroud)

请求标题

view source
Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Host:localhost:8088
Referer:http://localhost:8088/test/index.html
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36
Run Code Online (Sandbox Code Playgroud)

请帮我看看这里出了什么问题.当我在远程服务器中执行此设置时,也会发生同样的情况.

compression gzip http-compression tomcat8

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

为什么gzip压缩在IIS 8.5上不起作用?

我无法在Server 2012 R2计算机上的IIS 8.5上使用gzip压缩。我进行了一些研究,并按照这些职位中的说明进行操作:

  1. 如何在IIS 7.5中启用GZIP压缩
  2. IIS 8.5中的压缩未成功,说明ALREADY_CONTENT_ENCODING
  3. IIS 7.5上的GZip压缩不起作用
  4. gzip压缩不适用于IIS 8.5

这是我的配置的相关部分:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" staticCompressionIgnoreHitFrequency="true">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
    <!-- I have read that dynamic compression increases server CPU load.
    <dynamicTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/javascript" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
    </dynamicTypes>
    -->
    <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
    </staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
Run Code Online (Sandbox Code Playgroud)

另外,在IIS中,我将压缩设置为适用于大于256字节的任何内容。我已经执行了iisreset。

尽管如此,我在Chrome或IE的开发人员控制台中看不到压缩功能,而PageSpeed仍然告诉我要压缩内容。我错过了哪一个简单的步骤?

asp.net iis gzip http-compression iis-8.5

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

压缩响应无效

我想在我的Asp.Net网站中压缩响应。我写了这段代码:

public static void CompressPage(HttpRequest Request, HttpResponse Response)
{
    string acceptEncoding = Request.Headers["Accept-Encoding"];
    Stream prevUncompressedStream = Response.Filter;

    if (acceptEncoding.IsEmpty())
    {
        return;
    }

    acceptEncoding = acceptEncoding.ToLower();

    if (acceptEncoding.Contains("gzip"))
    {
        Response.Filter = new GZipStream(prevUncompressedStream, CompressionMode.Compress);
        Response.AppendHeader("Content-Encoding", "gzip");
    }
    else if (acceptEncoding.Contains("deflate"))
    {
        Response.Filter = new DeflateStream(prevUncompressedStream, CompressionMode.Compress);
            Response.AppendHeader("Content-Encoding", "deflate");
    }
}
Run Code Online (Sandbox Code Playgroud)

并称之为Page_Load事件:

protected void Page_Load(object sender, EventArgs e)
{
    ...
    ZipHtmlPage.CompressPage(Request, Response);
}
Run Code Online (Sandbox Code Playgroud)

问题是当我运行有无上述代码的代码时Page_Load,响应的大小不会改变。

在此处输入图片说明

问题出在哪里?

谢谢


编辑1)

我认为这"Content-Encoding", "gzip"不会增加标题:

在此处输入图片说明

不知道为什么


编辑2)

当我HttpModule用于执行http压缩时: …

c# asp.net gzip response http-compression

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