<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <!-- Minden kérést továbbítunk a Metabase felé -->
        <rule name="ReverseProxyToMetabase" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
          <action type="Rewrite" url="http://aps-mysql01.aps.local:3000/{R:1}" />
        </rule>
      </rules>

      <!-- Fejlécek átírása, hogy ne legyen benne a 3000-es port -->
      <outboundRules>
        <rule name="RewriteLocationHeader" preCondition="ResponseIsRedirect" enabled="true">
          <match serverVariable="RESPONSE_Location" pattern="^http://aps-mysql01\.aps\.local:3000/(.*)" />
          <action type="Rewrite" value="http://drucker.aps.local/{R:1}" />
        </rule>

        <preConditions>
          <preCondition name="ResponseIsRedirect">
            <add input="{RESPONSE_Status}" pattern="3\d\d" />
          </preCondition>
        </preConditions>
      </outboundRules>
    </rewrite>

    <!-- Proxy beállítás -->
    <proxy enabled="true" preserveHostHeader="true" reverseRewriteHostInResponseHeaders="true" />
  </system.webServer>
</configuration>
