Skip to content

Instantly share code, notes, and snippets.

@wrr
Created December 7, 2018 12:37
Show Gist options
  • Save wrr/0f2c0206ce53d0093c9449ae1e1a916c to your computer and use it in GitHub Desktop.
Save wrr/0f2c0206ce53d0093c9449ae1e1a916c to your computer and use it in GitHub Desktop.
IIS server configuration file for self-hosting of Shapespark bundles.
<?xml version="1.0" encoding="UTF-8"?>
<!--
IIS site configuration file for Shapespark self-hosting bundles.
Requires URL rewrite extension: https://www.iis.net/downloads/microsoft/url-rewrite
Extract the Shapespark bundle together with this config file to a
folder that is configured as a IIS site (<sites> section of
the applicationhost.config).
-->
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<rule name="Set Content-Encoding header for precompressed files">
<match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
<conditions>
<add input="{REQUEST_URI}" pattern=".(bmp|buf|js|json|ktx|svg|ico)$" />
</conditions>
<action type="Rewrite" value="gzip"/>
</rule>
<rule name="Enable caching for never changing resources">
<match serverVariable="RESPONSE_Cache_Control" pattern=".*" />
<conditions>
<add input="{REQUEST_URI}" pattern=".*$" />
</conditions>
<action type="Rewrite" value="public, max-age=15552000"/>
</rule>
<rule name="Disable caching for changing resources">
<match serverVariable="RESPONSE_Cache_Control" pattern=".*" />
<conditions>
<add input="{REQUEST_URI}" pattern="(index.html|cover.json)$" />
</conditions>
<action type="Rewrite" value="no-store, no-cache, must-revalidate, max-age=0"/>
</rule>
<rule name="Disalow content type guessing">
<match serverVariable="RESPONSE_X_Content_Type_Options" pattern=".*" />
<action type="Rewrite" value="nosniff"/>
</rule>
</outboundRules>
</rewrite>
<staticContent lockAttributes="isDocFooterFileName">
<mimeMap fileExtension=".buf" mimeType="application/binary" />
<mimeMap fileExtension=".ktx" mimeType="application/binary" />
</staticContent>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment