Skip to content

Instantly share code, notes, and snippets.

@kfrancis
Created November 12, 2019 16:30
Show Gist options
  • Save kfrancis/48265d2deb926f7d3e181a23761c2b8f to your computer and use it in GitHub Desktop.
Save kfrancis/48265d2deb926f7d3e181a23761c2b8f to your computer and use it in GitHub Desktop.
Intercom Reverse IIS Proxy for Let's Encrypt SSL
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
<rewrite>
<rules>
<!-- Make all requests https -->
<rule name="Https redirect" stopProcessing="true">
<match url="(.*)" />
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
<conditions>
<add input="{HTTP_HOST}" pattern="^support.yourdomain.com$" />
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
</rule>
<!-- Allow let's encrypt to generate a cert for this site -->
<rule name="LetsEncrypt" stopProcessing="true">
<match url=".well-known/acme-challenge/*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
<!-- Reverse proxy -->
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^support.yourdomain.com$" />
</conditions>
<action type="Rewrite" url="https://custom.intercom.help:443/{R:1}" />
<serverVariables>
<set name="HTTP_X_FORWARDED_HOST" value="support.yourdomain.com" />
</serverVariables>
</rule>
</rules>
</rewrite>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<add name="strict-transport-security" value="max-age=16070400" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment