<?xml version="1.0" encoding="UTF-8"?>
<!--
  Kindie — IIS reverse proxy example (Windows Server)

  Prerequisites (install once via Web Platform Installer or the MSI downloads):
    - IIS with the "Application Request Routing" (ARR) module
    - IIS "URL Rewrite" module
    - In IIS Manager, click the server name (top of the tree) -> "Application
      Request Routing Cache" -> "Server Proxy Settings..." -> check "Enable
      proxy" -> Apply. This one step is required, or every request below
      returns a 502.

  1. Create a new IIS site (or use Default Web Site) with its physical path
     set to an empty folder, and bind it to your domain on ports 80/443.
  2. Copy this file into that folder, renamed to "web.config".
  3. Get an SSL certificate with win-acme (free, Let's Encrypt) — run wacs.exe
     as Administrator and follow the prompts; it also binds the certificate
     to your site for you. See "Production Deployment" in the user guide.

  See "Production Deployment" in the Kindie user guide for the full walkthrough.
-->
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Kindie reverse proxy" stopProcessing="true">
          <match url="(.*)" />
          <action type="Rewrite" url="http://127.0.0.1:1337/{R:1}" />
          <serverVariables>
            <!-- Required so the app knows it's being served over HTTPS
                 (secure cookies, correct links in outgoing email). -->
            <set name="HTTP_X_FORWARDED_PROTO" value="{HTTPS}" replace="true" />
          </serverVariables>
        </rule>
      </rules>
    </rewrite>
    <!-- Allow uploads (photos, documents) up to ~20 MB. -->
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="20971520" />
      </requestFiltering>
    </security>
  </system.webServer>
</configuration>
