Skip to content

Instantly share code, notes, and snippets.

@wrr wrr/web.config
Created Dec 7, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.