﻿<configuration>
  <system.webServer>
    <staticContent>
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
      <!-- IIS won't serve a file whose extension isn't registered in
           static content — it returns 404 from the static handler.
           Default Azure App Service (Windows) configs sometimes lack
           these video types, so register them explicitly. -->
      <remove fileExtension=".mp4" />
      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
      <remove fileExtension=".webm" />
      <mimeMap fileExtension=".webm" mimeType="video/webm" />
      <remove fileExtension=".ogg" />
      <mimeMap fileExtension=".ogg" mimeType="video/ogg" />
      <remove fileExtension=".mov" />
      <mimeMap fileExtension=".mov" mimeType="video/quicktime" />
    </staticContent>
    <rewrite>
      <rules>
        <rule name="Angular 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="/" />
        </rule>
      </rules>
    </rewrite>
    <httpProtocol>
      <customHeaders>
        <!-- PCI-Compliant Security Headers -->
        <!-- frame-ancestors also lists the admin origins: the checkout theme
             editor previews the live SPA (checkouts/preview/theme, log-in) in
             an iframe. Unlike the storefront builder — which frames the API's
             server-rendered preview and relaxes framing there via
             ThemeV2FrameGuard — the checkout is an Angular SPA served from
             here, so this header is the only thing that can allow it. Scoping
             it to those routes with a <location> block is unreliable: the
             Angular rewrite above sends every route to "/". -->
        <add name="X-Content-Type-Options" value="nosniff" />
        <add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains" />
        <remove name="X-Frame-Options" />
        <remove name="Content-Security-Policy" />
        <add name="Content-Security-Policy" value="frame-ancestors 'self' https://www.warragulstorage.com.au https://warragulstorage.com.au https://www.allinghamremovals.com.au https://allinghamremovals.com.au https://www.storageville.co.nz https://storageville.co.nz https://www.pkgstorage.com.au https://pkgstorage.com.au https://www.portstorage.com.au https://portstorage.com.au https://admin.alyta.com https://admin.alyta.dev https://demo-admin.alyta.dev;" />
        <add name="Pragma" value="public" />
        <add name="Cache-Control" value="public, max-age=86400" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
  <!-- Embed routes are intentionally framed by external sites; relax frame restrictions. -->
  <location path="embed">
    <system.webServer>
      <httpProtocol>
        <customHeaders>
          <remove name="X-Frame-Options" />
          <remove name="Content-Security-Policy" />
          <add name="Content-Security-Policy" value="frame-ancestors *;" />
        </customHeaders>
      </httpProtocol>
    </system.webServer>
  </location>
</configuration>

