Skip to content

Instantly share code, notes, and snippets.

@Antaris
Created May 28, 2013 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Antaris/5663603 to your computer and use it in GitHub Desktop.
Save Antaris/5663603 to your computer and use it in GitHub Desktop.
Older Android devices seem to struggle with Cassette's release urls (/cassette.axd/styleseet/*, etc) because of the presence of an underscore. The following re-write rules will rewrite the outbound html to change the urls to something Android 2.* devices will like, and an inbound rewrite to match incoming requests to the CassetteHttpHandler. Thi…
<rewrite>
<outboundRules>
<rule name="CassetteOutboundUrl" preCondition="HtmlContent" stopProcessing="false">
<match filterByTags="Link, Script" pattern="^/cassette.axd/(.*?)/(.*)" />
<action type="Rewrite" value="/cassette.axd/?type={R:1}&amp;data={R:2}" />
</rule>
<preConditions>
<remove name="HtmlContent" />
<preCondition name="HtmlContent">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
<add input="{USER_AGENT}" pattern="android 2.*?;" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="CassetteIncomingUrl">
<match url="^cassette.axd/" />
<action type="Rewrite" url="/cassette.axd/{C:1}/{C:2}" appendQueryString="false" />
<conditions trackAllCaptures="true">
<add input="{QUERY_STRING}" pattern="type=(.*?)&amp;data=(.*)" />
<add input="{USER_AGENT}" pattern="android 2.*?;" />
</conditions>
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
</rule>
</rules>
</rewrite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment