Skip to content

Instantly share code, notes, and snippets.

@wh0am1-dev
Created July 15, 2019 08:28
Show Gist options
  • Save wh0am1-dev/701ca67aec23de2f13f276782802b844 to your computer and use it in GitHub Desktop.
Save wh0am1-dev/701ca67aec23de2f13f276782802b844 to your computer and use it in GitHub Desktop.
SPPWA on IIS

SPPWA on IIS

Single page progressive web application on Internet Information Services.

  1. Download and install the URL Rewrite module
  2. Add this web.config to your application root directory
  3. Profit 🎉
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!-- HTTPS -->
<rule name="HTTP to HTTPS Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{SERVER_PORT_SECURE}" pattern="^0$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
<!-- SPA -->
<rule name="SPA Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment