Umbraco: Custom Examine index with AWS flexible load balancing on EBS - amazon-web-services

Does anyone have an example of how to get this working?
I have a custom indexer, configured in ExamineSettings.config like this:
<add name="KeywordsIndexer"
type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine"
dataService="SearchIndexers.ParagraphKeywordIndexer"
directoryFactory="Examine.LuceneEngine.Directories.TempEnvDirectoryFactory,Examine"
indexTypes="KeywordIndexItem"/>
a search provider
<add name="KeywordsSearcher"
indexSet="KeywordsIndexSet"
enableLeadingWildcards="true"
type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" />
and an index set, in ExamineIndex.config
<IndexSet SetName="KeywordsIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Keywords/" IndexParentId="1119">
<IndexUserFields>
<add Name="ParagraphId" />
<add Name="ArticleId" />
<add Name="ChapterId" />
<add Name="Keywords1" />
<add Name="Keywords2" />
<add Name="Keywords3" />
<add Name="Keywords4" />
<add Name="Keywords5" />
<add Name="Keywords6" />
<add Name="Keywords7" />
<add Name="Keywords8" />
<add Name="Keywords9" />
<add Name="Keywords10" />
</IndexUserFields>
</IndexSet>
I then have a custom class which implements ISimpleDataService to query the content and create custom items which are inserted into the Index.
This all works fine when generating the index manually through the back-end Rebuild Index button, but I have no idea how to get this to propagate from the master machine to the slave machines (1 master, 1 slave at the moment in this setup https://aws.amazon.com/blogs/devops/run-umbraco-cms-with-flexible-load-balancing-on-aws/).
I believe I have two questions:
1) How can I get the index to automatically rebuild when content is published on the master server? (ideally only content within a specific parent/of a specific type)
2) Once rebuilt, how can I get the index to propagate to the slave machines so that the newly-rebuilt index is updated on all of them?
The docs are all Azure-specific so it's difficult to tell what is necessary and what isn't for AWS EBS. I've seen a few references to "it just works", but unfortunately that's definitely not the case in my experience so far!
Any help would be greatly appreciated.

Related

ELMAH MVC Route not displaying

I just installed ELMAH.Mvc and left all the default configurations and I am able to get to the elmah route and see my log. however, when i deploy my application I get a 403 Forbidden Access page. I thought since I had the requiresAuthentication flag set to false it would be available. Here are my settings:
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="false" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
any help would be great!
doh! I needed to add this to my web.config:
<security allowRemoteAccess="yes" />

deployment of a web.config to amazon beanstalk

When I deploy a .net web application to Amazon Beanstalk, my local web.config gets completely ignored and it just gets replaced with this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="PARAM3" value="" />
<add key="PARAM4" value="" />
<add key="PARAM1" value="" />
<add key="PARAM2" value="" />
<add key="PARAM5" value="" />
<add key="AWS_SECRET_KEY" value="" />
<add key="AWSSecretKey" value="" />
<add key="AWS_ACCESS_KEY_ID" value="" />
<add key="AWSAccessKey" value="" />
</appSettings>
</configuration>
I thought that beanstalk wasn't able to parse some section of my web.config so I simplified the web.config to the minimum:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="mykey" value="myvalue"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
And I get the same result. my appSettings and every other section of my web.config don't appear in the web.config that gets deployed.
I looked everywhere and I can't find documentation on this.
I don't have any transforms in my local application (i.e. no web.release.config file).
Can I disable this "feature" of Beanstalk somehow?
I don't ask for any action, I just want my original web.config deployed.
Set the environment variables in the Elastic Beanstalk console, not in your git repository.

Sitecore 8 - Mongo automation DB

I am setting up Sitecore 8 and a few of the blogs mention the “automation.live”, “automation.history” DBs.
Example
But in the official documentation there is no mention of these
Does anyone know what “automation.live” & "“automation.history” are for, and if they are required?
Your example blog relates to an early pre-release version of the xDB, and I don't think it's accurate now.
It's likely that the function of those databases has now been picked up by "tracking.live", "tracking.history" and "analytics".
Here is the connection strings file from one of my local Sitecore 8 implementations:
<?xml version="1.0" encoding="utf-8"?>
<connectionStrings>
<!--
Sitecore connection strings.
All database connections for Sitecore are configured here.
-->
<add name="core" connectionString="Data Source=.;Initial Catalog=sc80rev150121Sitecore_core;Integrated Security=False;User ID=sa;Password=secret" />
<add name="master" connectionString="Data Source=.;Initial Catalog=sc80rev150121Sitecore_master;Integrated Security=False;User ID=sa;Password=secret" />
<add name="web" connectionString="Data Source=.;Initial Catalog=sc80rev150121Sitecore_web;Integrated Security=False;User ID=sa;Password=secret" />
<add name="analytics" connectionString="mongodb://localhost:27017/sc80rev150121_analytics" />
<add name="tracking.live" connectionString="mongodb://localhost:27017/sc80rev150121_tracking_live" />
<add name="tracking.history" connectionString="mongodb://localhost:27017/sc80rev150121_tracking_history" />
<add name="tracking.contact" connectionString="mongodb://localhost:27017/sc80rev150121_tracking_contact" />
<add name="reporting" connectionString="Data Source=.;Initial Catalog=sc80rev150121Sitecore_reporting;Integrated Security=False;User ID=sa;Password=secret" />
</connectionStrings>

How to enable GZIP compression in IIS 7.5

I want to compress my files using GZIP. Can you share the web.config code for compressing files with GZIP?
Is there anything more that I have to do after uploading my web.config file?
GZip Compression can be enabled directly through IIS.
First, open up IIS,
go to the website you are hoping to tweak and hit the Compression page. If Gzip is not installed, you will see something like the following:
“The dynamic content compression module is not installed.” We should fix this. So we go to the “Turn Windows features on or off” and select “Dynamic Content Compression” and click the OK button.
Now if we go back to IIS, we should see that the compression page has changed. At this point we need to make sure the dynamic compression checkbox is checked and we’re good to go. Compression is enabled and our dynamic content will be Gzipped.
Testing - Check if GZIP Compression is Enabled
To test whether compression is working or not, use the developer tools in Chrome or Firebug for Firefox and ensure the HTTP response header is set:
Content-Encoding: gzip
If anyone runs across this and is looking for a bit more up-to-date answer or copy-paste answer or answer targeting multiple versions than JC Raja's post, here's what I've found:
Google's got a pretty solid, easy-to-understand introduction to how this works and what is advantageous and not.
https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/optimize-encoding-and-transfer
They recommend the HTML5 Boilerplate project, which has solutions for different versions of IIS:
.NET version 3
.NET version 4
.NET version 4.5 / MVC 5
Available here: https://github.com/h5bp/server-configs-iis
They have web.configs that you can copy and paste changes from theirs to yours and see the changes, much easier than digging through a bunch of blog posts.
Here's the web.config settings for .NET version 4.5:
https://github.com/h5bp/server-configs-iis/blob/master/dotnet%204.5/MVC5/Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.5" />
<!-- Security through obscurity, removes X-AspNet-Version HTTP header from the response -->
<!-- Allow zombie DOS names to be captured by ASP.NET (/con, /com1, /lpt1, /aux, /prt, /nul, etc) -->
<httpRuntime targetFramework="4.5" requestValidationMode="2.0" requestPathInvalidCharacters="" enableVersionHeader="false" relaxedUrlToFileSystemMapping="true" />
<!-- httpCookies httpOnlyCookies setting defines whether cookies
should be exposed to client side scripts
false (Default): client side code can access cookies
true: client side code cannot access cookies
Require SSL is situational, you can also define the
domain of cookies with optional "domain" property -->
<httpCookies httpOnlyCookies="true" requireSSL="false" />
<trace writeToDiagnosticsTrace="false" enabled="false" pageOutput="false" localOnly="true" />
</system.web>
<system.webServer>
<!-- GZip static file content. Overrides the server default which only compresses static files over 2700 bytes -->
<httpCompression directory="%SystemDrive%\websites\_compressed" minFileSizeForComp="1024">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<httpErrors existingResponse="PassThrough" errorMode="Custom">
<!-- Catch IIS 404 error due to paths that exist but shouldn't be served (e.g. /controllers, /global.asax) or IIS request filtering (e.g. bin, web.config, app_code, app_globalresources, app_localresources, app_webreferences, app_data, app_browsers) -->
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" subStatusCode="-1" path="/notfound" responseMode="ExecuteURL" />
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" subStatusCode="-1" path="/error" responseMode="ExecuteURL" />
</httpErrors>
<directoryBrowse enabled="false" />
<validation validateIntegratedModeConfiguration="false" />
<!-- Microsoft sets runAllManagedModulesForAllRequests to true by default
You should handle this according to need but consider the performance hit.
Good source of reference on this matter: http://www.west-wind.com/weblog/posts/2012/Oct/25/Caveats-with-the-runAllManagedModulesForAllRequests-in-IIS-78
-->
<modules runAllManagedModulesForAllRequests="false" />
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
<staticContent>
<!-- Set expire headers to 30 days for static content-->
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
<!-- use utf-8 encoding for anything served text/plain or text/html -->
<remove fileExtension=".css" />
<mimeMap fileExtension=".css" mimeType="text/css" />
<remove fileExtension=".js" />
<mimeMap fileExtension=".js" mimeType="text/javascript" />
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<remove fileExtension=".rss" />
<mimeMap fileExtension=".rss" mimeType="application/rss+xml; charset=UTF-8" />
<remove fileExtension=".html" />
<mimeMap fileExtension=".html" mimeType="text/html; charset=UTF-8" />
<remove fileExtension=".xml" />
<mimeMap fileExtension=".xml" mimeType="application/xml; charset=UTF-8" />
<!-- HTML5 Audio/Video mime types-->
<remove fileExtension=".mp3" />
<mimeMap fileExtension=".mp3" mimeType="audio/mpeg" />
<remove fileExtension=".mp4" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<remove fileExtension=".ogg" />
<mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
<remove fileExtension=".ogv" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<remove fileExtension=".webm" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
<!-- Proper svg serving. Required for svg webfonts on iPad -->
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<remove fileExtension=".svgz" />
<mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
<!-- HTML4 Web font mime types -->
<!-- Remove default IIS mime type for .eot which is application/octet-stream -->
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<remove fileExtension=".ttf" />
<mimeMap fileExtension=".ttf" mimeType="application/x-font-ttf" />
<remove fileExtension=".ttc" />
<mimeMap fileExtension=".ttc" mimeType="application/x-font-ttf" />
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="font/opentype" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<remove fileExtension=".crx" />
<mimeMap fileExtension=".crx" mimeType="application/x-chrome-extension" />
<remove fileExtension=".xpi" />
<mimeMap fileExtension=".xpi" mimeType="application/x-xpinstall" />
<remove fileExtension=".safariextz" />
<mimeMap fileExtension=".safariextz" mimeType="application/octet-stream" />
<!-- Flash Video mime types-->
<remove fileExtension=".flv" />
<mimeMap fileExtension=".flv" mimeType="video/x-flv" />
<remove fileExtension=".f4v" />
<mimeMap fileExtension=".f4v" mimeType="video/mp4" />
<!-- Assorted types -->
<remove fileExtension=".ico" />
<mimeMap fileExtension=".ico" mimeType="image/x-icon" />
<remove fileExtension=".webp" />
<mimeMap fileExtension=".webp" mimeType="image/webp" />
<remove fileExtension=".htc" />
<mimeMap fileExtension=".htc" mimeType="text/x-component" />
<remove fileExtension=".vcf" />
<mimeMap fileExtension=".vcf" mimeType="text/x-vcard" />
<remove fileExtension=".torrent" />
<mimeMap fileExtension=".torrent" mimeType="application/x-bittorrent" />
<remove fileExtension=".cur" />
<mimeMap fileExtension=".cur" mimeType="image/x-icon" />
<remove fileExtension=".webapp" />
<mimeMap fileExtension=".webapp" mimeType="application/x-web-app-manifest+json; charset=UTF-8" />
</staticContent>
<httpProtocol>
<customHeaders>
<!--#### SECURITY Related Headers ###
More information: https://www.owasp.org/index.php/List_of_useful_HTTP_headers
-->
<!--
# Access-Control-Allow-Origin
The 'Access Control Allow Origin' HTTP header is used to control which
sites are allowed to bypass same-origin policies and send cross-origin requests.
Secure configuration: Either do not set this header or return the 'Access-Control-Allow-Origin'
header restricting it to only a trusted set of sites.
http://enable-cors.org/
<add name="Access-Control-Allow-Origin" value="*" />
-->
<!--
# Cache-Control
The 'Cache-Control' response header controls how pages can be cached
either by proxies or the user's browser.
This response header can provide enhanced privacy by not caching
sensitive pages in the user's browser cache.
<add name="Cache-Control" value="no-store, no-cache"/>
-->
<!--
# Strict-Transport-Security
The HTTP Strict Transport Security header is used to control
if the browser is allowed to only access a site over a secure connection
and how long to remember the server response for, forcing continued usage.
Note* Currently a draft standard which only Firefox and Chrome support. But is supported by sites like PayPal.
<add name="Strict-Transport-Security" value="max-age=15768000"/>
-->
<!--
# X-Frame-Options
The X-Frame-Options header indicates whether a browser should be allowed
to render a page within a frame or iframe.
The valid options are DENY (deny allowing the page to exist in a frame)
or SAMEORIGIN (allow framing but only from the originating host)
Without this option set, the site is at a higher risk of click-jacking.
<add name="X-Frame-Options" value="SAMEORIGIN" />
-->
<!--
# X-XSS-Protection
The X-XSS-Protection header is used by Internet Explorer version 8+
The header instructs IE to enable its inbuilt anti-cross-site scripting filter.
If enabled, without 'mode=block', there is an increased risk that
otherwise, non-exploitable cross-site scripting vulnerabilities may potentially become exploitable
<add name="X-XSS-Protection" value="1; mode=block"/>
-->
<!--
# MIME type sniffing security protection
Enabled by default as there are very few edge cases where you wouldn't want this enabled.
Theres additional reading below; but the tldr, it reduces the ability of the browser (mostly IE)
being tricked into facilitating driveby attacks.
http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx
http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
-->
<add name="X-Content-Type-Options" value="nosniff" />
<!-- A little extra security (by obscurity), removings fun but adding your own is better -->
<remove name="X-Powered-By" />
<add name="X-Powered-By" value="My Little Pony" />
<!--
With Content Security Policy (CSP) enabled (and a browser that supports it (http://caniuse.com/#feat=contentsecuritypolicy),
you can tell the browser that it can only download content from the domains you explicitly allow
CSP can be quite difficult to configure, and cause real issues if you get it wrong
There is website that helps you generate a policy here http://cspisawesome.com/
<add name="Content-Security-Policy" "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' https://www.google-analytics.com;" />
-->
<!--//#### SECURITY Related Headers ###-->
<!--
Force the latest IE version, in various cases when it may fall back to IE7 mode
github.com/rails/rails/commit/123eb25#commitcomment-118920
Use ChromeFrame if it's installed for a better experience for the poor IE folk
-->
<add name="X-UA-Compatible" value="IE=Edge,chrome=1" />
<!--
Allow cookies to be set from iframes (for IE only)
If needed, uncomment and specify a path or regex in the Location directive
<add name="P3P" value="policyref="/w3c/p3p.xml", CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"" />
-->
</customHeaders>
</httpProtocol>
<!--
<rewrite>
<rules>
Remove/force the WWW from the URL.
Requires IIS Rewrite module http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/
Configuration lifted from http://nayyeri.net/remove-www-prefix-from-urls-with-url-rewrite-module-for-iis-7-0
NOTE* You need to install the IIS URL Rewriting extension (Install via the Web Platform Installer)
http://www.microsoft.com/web/downloads/platform.aspx
** Important Note
using a non-www version of a webpage will set cookies for the whole domain making cookieless domains
(eg. fast CD-like access to static resources like CSS, js, and images) impossible.
# IMPORTANT: THERE ARE TWO RULES LISTED. NEVER USE BOTH RULES AT THE SAME TIME!
<rule name="Remove WWW" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
</conditions>
<action type="Redirect" url="http://example.com{PATH_INFO}" redirectType="Permanent" />
</rule>
<rule name="Force WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example.com$" />
</conditions>
<action type="Redirect" url="http://www.example.com/{R:0}" redirectType="Permanent" />
</rule>
# E-TAGS
E-Tags are actually quite useful in cache management especially if you have a front-end caching server such as Varnish. http://en.wikipedia.org/wiki/HTTP_ETag / http://developer.yahoo.com/performance/rules.html#etags
But in load balancing and simply most cases ETags are mishandled in IIS, and it can be advantageous to remove them.
# removed as in https://stackoverflow.com/questions/7947420/iis-7-5-remove-etag-headers-from-response
<rewrite>
<outboundRules>
<rule name="Remove ETag">
<match serverVariable="RESPONSE_ETag" pattern=".+" />
<action type="Rewrite" value="" />
</rule>
</outboundRules>
</rewrite>
-->
<!--
### Built-in filename-based cache busting
In a managed language such as .net, you should really be using the internal bundler for CSS + js
or get cassette or similar.
If you're not using the build script to manage your filename version revving,
you might want to consider enabling this, which will route requests for
/css/style.20110203.css to /css/style.css
To understand why this is important and a better idea than all.css?v1231,
read: github.com/h5bp/html5-boilerplate/wiki/Version-Control-with-Cachebusting
<rule name="Cachebusting">
<match url="^(.+)\.\d+(\.(js|css|png|jpg|gif)$)" />
<action type="Rewrite" url="{R:1}{R:2}" />
</rule>
</rules>
</rewrite>-->
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Edit: One update if you need Gzip compression on WebAPI responses.
I wasn't aware our WebAPI wasn't returning Gzipped responses until recently and scratched my head for a while because we had dynamic and static compression turned on in web.config. We looked at writing our own compression services and response handlers (still on WebAPI 2 not on .NET Core where it's easier now), but that was too cumbersome for what seemed like something we should just be able to turn on.
(If you're interested here's what we were looking at for our own compression service https://krzysztofjakielaszek.com/2017/03/26/webapi2-response-compression-gzip-brotli-deflate/
EDIT: Link is now offline, but you can view the code/content here: https://web.archive.org/web/20190608161201/https://krzysztofjakielaszek.com/2017/03/26/webapi2-response-compression-gzip-brotli-deflate/ )
Instead, we found this great post by Ben Foster (http://benfoster.io/blog/aspnet-web-api-compression)
If you can modify applicationHost.config (running your own servers), you can pop that config file open and add the mimeTypes you want to compress (I pulled the relevant ones based on what our API was returning to clients from our Web.Config). Save that file, IIS will pickup your changes, recycle app pools, and your WebAPI will start returning gzip compressed responses to clients who request it.
If you don't see gzipped responses, check the response content type with Fiddler or Chrome/Firefox Dev Tools, and ensure it matches what you added. I had to change the view mode (use large request rows) in Chrome Dev Tools to ensure it showed the total size vs transferred size. If everything validates, try rebooting the server once to just ensure it was properly applied. I did have one syntax error where when I opened up the site in IIS, IIS poppped open a message about a parsing error that I had to fix in the config file.
<httpCompression directory="%TEMP%\iisexpress\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%IIS_BIN%\gzip.dll" />
<dynamicTypes>
...
<!-- compress JSON responses from Web API -->
<add mimeType="application/json" enabled="true" />
...
</dynamicTypes>
<staticTypes>
...
</staticTypes>
</httpCompression>
Global Gzip in HttpModule
If you don't have access to shared hosting - the final IIS instance. You can create a HttpModule that gets added this code to every HttpApplication.Begin_Request event:-
HttpContext context = HttpContext.Current;
context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress);
HttpContext.Current.Response.AppendHeader("Content-encoding", "gzip");
HttpContext.Current.Response.Cache.VaryByHeaders["Accept-encoding"] = true;
Filing this under #wow
Turns out that IIS has different levels of compression configurable from 1-9.
Some of my dynamic SOAP requests have been getting out of control recently. With the uncompressed SOAP being about 14MB and compressed 3MB.
I noticed that in Fiddler when I compressed my request under Transformer it came to about 470KB instead of the 3MB - so I figured there must be some way to get better compression.
Eventually found this very informative blog post
http://weblogs.asp.net/owscott/iis-7-compression-good-bad-how-much
I went ahead and ran this commnd (followed by iisreset):
C:\Windows\System32\Inetsrv\Appcmd.exe set config -section:httpCompression -[name='gzip'].staticCompressionLevel:9 -[name='gzip'].dynamicCompressionLevel:9
Changed dynamic level up to 9 and now my compressed soap matches what Fiddler gave me - and it about 1/7th the size of the existing compressed file.
Milage will vary, but for SOAP this is a massive massive improvement.
This is more an add-on to the best answer above (GZip Compression can be enabled directly through IIS) which is correct if your running IIS on Windows desktop however...
If your running IIS on Windows Server, this content compression feature is found in a different place to desktop Windows (not in programs and features in Control Panel). First open "Server Manager" then click Manage -> "Add Roles & Features" then keep clicking NEXT (make sure you select the correct server when you see the list of servers if your managing multiple servers from this instance) until you get to SERVER ROLES, scroll down to and open "Web Server (IIS)..." then "Web Server" then "Performance" then tick "Dynamic Content Compression" then click INSTALL. I tested this on Server 2016 Standard so there may be slight differences if your on an earlier version of Server.
Then follow the instructions from Testing - Check if GZIP Compression is Enabled
Sometimes no matter what you do or follow whole internet posts. Try on the MIMETYPES of applicationhost.config of the server.
https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httpcompression/#configuration-sample

ColdFusion with IIS URL Rewrite - Page never finishes loading

I am running CF10 on IIS 7.5 with URL Rewrite module installed.
All the rewrite rules work perfectly and ColdFusion is returning the correct pages. In order to get the page displayed in the browser I have to manually set the 'content-length' value in Application.cfc like this:
<cfcomponent>
<cffunction name="onRequestEnd">
<cfheader name="Content-Length" value="#getPageContext().getCFOutput().getBuffer().size()#" />
</cffunction>
</cfcomponent>
Without this code the browser does not display the page. However, even though it is now displaying the page, it is not doing it correctly. The page never finishes loading fully and not all of the HTML content seems to be on the page.
I have tried to add a <cfflush /> tag after setting the 'content-length' but it makes no difference. I don't understand why this is happening but I know that it has happened to someone else who was using htaccess:http://forums.devshed.com/coldfusion-development-84/page-not-finishing -loading-coldfusion-and-htaccess-bug-575906.html
EDIT: Example Outbound/Inbound Rule Definition:
<!--- Outbound rule --->
<rule name="Rewrite Info Page" preCondition="IsHTML" enabled="false" stopProcessing="false">
<match filterByTags="A" pattern="^(.*)/info\.cfm\?subjectid=([^=&]+)&(?:amp;)?nameid=([^=&]+)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
<action type="Rewrite" value="{R:1}/info/{R:2}/{R:3}" />
</rule>
<preConditions>
<preCondition name="IsHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
<!--- Inbound rule --->
<rule name="Rewrite Info Page" enabled="true" stopProcessing="false">
<match url="^(.*)/info/([^/]+)/([^/]+)/?$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}/info.cfm?subjectid={R:2}&nameid={R:3}" appendQueryString="true" />
</rule>
The Outbound rule is looking at a URL link within an <a> tag that looks like http://mysite.com/info.cfm?subjectid=1&nameid=1 and then rewriting it to appear on my page as http://mysite.com/info/1/1.
The Inbound is looking for a link that looks like http://mysite/info/1/1 and resolving/rewriting it to the real URL which is http://mysite.com/info.cfm?subjectid=1&nameid=1
Since IIS URL Rewrite's outbound rules are giving you so much trouble, here is another option. Use ColdFusion to rewrite the links in onRequestEnd. This will allow you to use physical paths in your IDE, use default documents, and still get the outbound URLs sent to the browser in the desired format. I've updated my Gist with the details.
Here is a very basic approach. Turn off the outbound rewrite rule in web.config and add something like this to your onRequestEnd function in Application.cfc. (My regex is horrible, so this reReplace() pattern only partially works the way your IIS pattern did.
<cfcomponent>
<cffunction name="onRequestEnd">
<!--- Get the generated output --->
<cfset var output = getPageContext().getCFOutput().getBuffer().toString()>
<!--- Apply outbound link rules --->
<cfset output = reReplace(output, '/info\.cfm\?subjectid=([^=&]+)', '/info/\1', 'all')>
<!--- Clear the previous output and send the rewritten output in its place --->
<cfcontent reset="true">
<cfoutput>#output#</cfoutput>
</cffunction>
</cfcomponent>
This won't perform as well as the URL Rewrite module in IIS, but it will give you everything else you are trying to achieve (once you get your regex tuned up).
I was able to get your outbound rules to work pretty much as is on my local dev environment (although running CF9). The only trouble was getting the outbound rules wrapped in the correct XML elements.
After that, IIS told me outbound rules could not be applied to gzipped content, so I had to add <urlCompression doStaticCompression="true" doDynamicCompression="false"/> to the configuration.
With that in place, the outbound rewrite worked perfectly. I even ran it against a page that had over 20,000 links, and it handled it fine.
Here is my <rewrite> section for web.config along with the <urlCompression> bit:
<rewrite>
<rules>
<rule name="Rewrite Info" enabled="true" stopProcessing="false">
<match url="^(.*)/info/([^/]+)/([^/]+)/?$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}/info.cfm?subjectid={R:2}&nameid={R:3}" appendQueryString="true" />
</rule>
</rules>
<outboundRules>
<rule name="Rewrite Info Page" preCondition="IsHTML" enabled="true" stopProcessing="false">
<match filterByTags="A" pattern="^(.*)/info\.cfm\?subjectid=([^=&]+)&(?:amp;)?nameid=([^=&]+)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
<action type="Rewrite" value="{R:1}/info/{R:2}/{R:3}" />
</rule>
<preConditions>
<preCondition name="IsHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
<urlCompression doStaticCompression="true" doDynamicCompression="false"/>
I found no difference in the result when including <cfheader name="Content-Length" value="#getPageContext().getCFOutput().getBuffer().size()#" /> in onRequestEnd.
However, since you are getting the spinner and the page never seems to fully load, you might try explicitly flushing and closing the response in onRequestEnd to ensure the handoff back to IIS is complete:
<cfscript>
var response = getPageContext().getResponse().getResponse();
var out = response.getOutputStream();
out.flush();
out.close();
</cfscript>