I have followed this document and have enabled both Dynamic and Static compression for my website.
But when I test the website here, the compression is not enabled.
I have verified the HttpCompression:
<system.webServer>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="image/svg+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
</httpCompression>
</system.webServer>
I have also checked the following IIS Settings:
I see from your posted headers that the site is behind cloudfront (ie the via and x-cache headers).
Thus you may need to investigate having cloudfront provide compressed data: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html
I'm not particularly familiar with cloudfront, but since its adding the via header its acting as a proxy..
..you have noCompressionForProxies = True in your IIS settings screenshot.
This has some info on changing that setting https://community.spiceworks.com/topic/1989103-help-with-enabling-nocompressionforproxies-in-applicationhost-config-in-iis
As a 1st test you could try to hit your site by-passing cloudfront to directly test the IIS setup.
I have an existing IIS application, and I am trying to get GZIP server side compression to work. The application runs on EPIServer CMS (which I am not that familiar with) - Thinking this could be related to the CMS somehow, as a first step...
I decided to create a new IIS application and this time using Umbraco (another CMS that I am very familiar with) - I have created a basic page with some CSS files and images,
Content-Encoding: gzip
header.
This is what I have tried and checked.
Working locally, I am running windows 10. and IIS 10
I have enabled Dyamic Content Compression and Static Content Compression under Internet Information Services > Performance Features in Windows Features
For the locally set up website in IIS I have ensured that the compression section has both Enable Dynamic & Static check boxes are ticked.
In my web-config file I have added this single line
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="false" />
When the Webconfig has this line I inspect the headers in my browser:
REQUEST HEADERS
Accept: text/css,*/*;q=0.1
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Host: umbracotest.site
Proxy-Connection: keep-alive
Referer: http://umbracotest.site/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36
RESPONSE HEADERS
Accept-Ranges: bytes
Content-Type: text/css
Date: Tue, 01 May 2018 15:09:02 GMT
ETag: "03739d0e978d31:0"
Last-Modified: Tue, 19 Dec 2017 16:52:54 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding
If I change that webconfig line slightly - dynamicCompressionBeforeCache="false" to true - then I just get a whole bunch of symbols in the browser - does that mean anything?
If I add a few more lines in to my webconfig to look like this:
<system.webServer>
<httpCompression>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="image/jpeg" enabled="true" />
<add mimeType="image/png" enabled="true" />
<add mimeType="image/svg" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="image/jpeg" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"
dynamicCompressionLevel="8" />
</httpCompression>
<urlCompression doDynamicCompression="true" doStaticCompression="true"
dynamicCompressionBeforeCache="false" />
headers are still the same.
C:\inetpub\temp\IIS Temporary Compressed Files\MYAPPPOOL-NAME << this folder is created but empty.
This is a ASP.net MVC application
Any ideas?
So after banging my head on the wall for about 8 hours, I finally got it to work!
After checking everything twice, reading every post I could find on the topic, I came across a comment to a similar question that suggested it could be something to do with my antivirus software. I'm working in an enterprise environment and I don't have the rights to disable it on my local machine. So I deployed the code to our staging server......... and it works.
So in case someone else has this problem, try and disable your anti-virus and see if that makes any difference, it worked for me.
I set up a reverse proxy to be able to call SSRS behind our firewall. It's mostly working but I'm stuck trying to solve the pre-flight OPTIONS request that keeps getting a 403. Am I missing anymore configuration changes? I've seen other post where people were returning a 200 for OPTIONS request. Can that be done from a reverse proxy?
web.config (for reverse proxy)
<?xml version="1.0" encoding="UTF-8"?><configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<security>
<authorization>
<add accessType="Allow" users="*" verbs="GET,POST,PUT,OPTIONS" />
</authorization>
<requestFiltering>
<verbs applyToWebDAV="false">
<add verb="OPTIONS" allowed="true" />
</verbs>
</requestFiltering>
</security>
<handlers> <remove name="OPTIONSVerbHandler" />
<add name="MyOPTIONSVerbHandler" path="*" verb="OPTIONS" modules="StaticFileModule" requireAccess="None" />
</handlers><httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Request-Headers" value="Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization, Access-Control-Allow-Origin,Access-Control-Request-Headers,Access-Control-Allow-Credentials" />
<add name="Access-Control-Request-Methods" value="GET, PUT, POST, DELETE, HEAD, OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization, Access-Control-Allow-Origin,Access-Control-Request-Headers,Access-Control-Allow-Credentials" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, HEAD, OPTIONS" />
<add name="Access-Control-Allow-Credentials" value="true" />
<add name="Access-Control-Max-Age" value="1728000" />
</customHeaders> </httpProtocol>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://my-ssrs-url/{R:1}" />
<serverVariables>
<set name="HTTP_Authorization" value="Basic {omitted}" />
</serverVariables>
</rule>
</rules>
<outboundRules>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer></configuration>
Chrome Headers:
Request URL:http://my-reverseproxy-url:8088/reports/api/v1.0/CatalogItems(86f0591c-8eb5-4951-9ca3-d16a847d6dd6)/Model.DataSet/Model.GetData?maxRows=
Request Method:OPTIONS
Status Code:403 Forbidden
Remote Address:172.20.32.200:8088
Referrer Policy:no-referrer-when-downgrade
Response Headers
view source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization, Access-Control-Allow-Origin,Access-Control-Request-Headers,Access-Control-Allow-Credentials
Access-Control-Allow-Methods:GET, PUT, POST, DELETE, HEAD, OPTIONS
Access-Control-Allow-Origin:*
Access-Control-Max-Age:1728000
Access-Control-Request-Headers:Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization, Access-Control-Allow-Origin,Access-Control-Request-Headers,Access-Control-Allow-Credentials
Access-Control-Request-Methods:GET, PUT, POST, DELETE, HEAD, OPTIONS
Cache-Control:private
Content-Length:0
Date:Tue, 16 May 2017 16:58:53 GMT
Server:Microsoft-IIS/8.5
Set-Cookie:XSRF-NONCE=QxQVNGHrnygkOO5pESdPWSX7gD7N9IkyDFZeb8SSZeI%3D; path=/reports; HttpOnly
Set-Cookie:XSRF-TOKEN=voBxCxC7FAtwDnRDx%2B4tQ0UfBThZFcmq2cF0nwCbtKK%2FB6%2FI4TFt8lDA9OXmNABaAD4tKL2ygGnvp1MkucOgTqDlN3khUOaV8f2LbFWuMthkjOoH%2BcCXRWrmnx9akYOmRdPRyIB9Kxjq9Lz0px1%2BME6NtYvNnyxhUlnaczusO8k5wLNvo8OqTFB751b%2Fqm9E; path=/reports
X-Content-Type-Options:nosniff
X-Powered-By:ASP.NET
X-Powered-By:ARR/3.0
Request Headers
view source
Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:content-type,x-xsrf-token
Access-Control-Request-Method:POST
Connection:keep-alive
Host:my-reverseproxy-url:8088
Origin:http://my-ssrs-url
Referer:http://my-ssrs-url/reports/api/v1.0/SafeGetSystemResourceContent(type='mobilereportruntime',key='web')?v=3.9.118
User-Agent:Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Query String Parameters
view source
view URL encoded
maxRows:
Chrome Console:
OPTIONS http://my-reverseproxy-url:8088/reports/api/v1.0/CatalogItems(86f0591c-8eb5-4951-9ca3-d16a847d6dd6)/Model.DataSet/Model.GetData?maxRows= 403 (Forbidden)
XMLHttpRequest cannot load http://my-reverseproxy-url:8088/reports/api/v1.0/CatalogItems(86f0591c-8eb5-4951-9ca3-d16a847d6dd6)/Model.DataSet/Model.GetData?maxRows=. Response for preflight has invalid HTTP status code 403
Problems with activating Gzip on IIS 8 on a windows server 2012 (standard)
So i activated the compressions in the windows features
I checked both checkboxes in IIS - compression (dynamic and static)
But still no Gzip available. However, on my localhost machine (just a windows 10) this works.
What i do see, is that the gzip temp directory (C:\inetpub\temp\IIS Temporary Compressed Files) is getting filled up when i browse my site via the server localhost. BUT strangely enough i'm not seeing anything Gzip-ped in chrome.
The only headers (in chrome) are: HTTP/1.1 304 Not Modified Accept-Ranges: bytes ETag: "0a354779de8d11:0" Server: Microsoft-IIS/8.0 X-Powered-By: ASP.NET Date: Thu, 28 Jul 2016 13:41:04 GMT
(Even yslow is saying no gzip is activated)
When i remove the gzip temp folder, and browse to the site trough the 'official' website url, then nothing is even generated.
Does anyone has any idea what is going on here?
I added this in my web.config
<httpCompression>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="image/jpeg" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="image/jpeg" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" dynamicCompressionLevel="4" />
</httpCompression>
See this other topic, where i activated more log information, Gzip not working, server 2012, IIS 8
All i get is:
<RenderingInfo Culture="nl-BE">
<Opcode>STATIC_COMPRESSION_NOT_SUCCESS</Opcode>
<Keywords>
<Keyword>Compression</Keyword>
</Keywords>
<freb:Description Data="Reason">NO_MATCHING_SCHEME</freb:Description>
</RenderingInfo>
Can you try adding this to your web.config file ?? I suggest so because it worked for me on IIS windows shared hosting. Its similar to your code with a few changes...
<system.webServer>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
<dynamicTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="application/javascript; charset=utf-8" enabled="true"/>
<add mimeType="application/x-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="application/javascript; charset=utf-8" enabled="true"/>
<add mimeType="application/x-javascript" enabled="true"/>
<add mimeType="*/*" enabled="false"/>
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
</system.webServer>
I'm not sure if you need to add
<add mimeType="image/jpeg" enabled="true" />
Isn't jpeg a compressed format ? You could add it none the less if you wish to.
[OPTIONAL]: I read this at MaxCdn.
Origin servers should include Vary: Accept-Encoding, and here’s how:
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="Vary"></remove>
<add name="Vary" value="Accept-Encoding"></add>
</customHeaders>
</httpProtocol>
</system.webServer>
You can add this bit to your web.config file as well, deploy and check it in the request headers through your browser's developer tools itself.
Does anyone know why the following web.conig changes will NOT work:
<httpCompression>
<staticTypes>
<add mimeType="application/javascript" enabled="true"/>
</staticTypes>
<dynamicTypes>
<add mimeType="application/javascript" enabled="true"/>
</dynamicTypes>
</httpCompression>
After i added javascript files were still not being compressed (gzip). I thrased around for a couple days because i really didn't know what the problem was at first but now i do. If i change the applicationhost.config directly though it does work:
<httpCompression directory="%TEMP%\iisexpress\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%IIS_BIN%\gzip.dll" />
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" 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/x-javascript" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
It would be MUCH easier to change your web.config then trying to figure out what web servers applicationhost.config file is incorrect but unfortunately it doesn't work
That being said IIS Express is setup "incorrectly" by default. It gives javascript files a mimetype of "application/javascript" but only compresses javascript files that come across as "application/x-javascript". I don't know if IIS (not express) ever comes defaulted this way.
You could try adding the doDynamicCompression attribute with a value of true to the urlCompression attribute.
<urlCompression doDynamicCompression="true" />