<?xml version="1.0" encoding="UTF-8"?>
<!--
  ====================================================================
  ROA2WEB - Public IIS Server Configuration
  ====================================================================
  Server: 10.0.20.122 (roa2web.romfast.ro)
  Role: Public gateway / reverse proxy

  This web.config ONLY goes on the PUBLIC server (10.0.20.122).
  It proxies all requests to the internal application server (10.0.20.36).

  ⚠️ DO NOT use this config on 10.0.20.36!
  ====================================================================
-->
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <!-- Redirect root to /roa2web/ -->
        <rule name="Root to ROA2WEB" stopProcessing="true">
          <match url="^$" />
          <action type="Redirect" url="/roa2web/" redirectType="Permanent" />
        </rule>

        <!-- Reverse Proxy to internal application server -->
        <rule name="ROA2WEB Reverse Proxy to HTTPS Backend" stopProcessing="true">
          <match url="(.*)" />
          <action type="Rewrite" url="https://10.0.20.36/{R:1}" />
          <serverVariables>
            <set name="HTTP_X_FORWARDED_PROTO" value="https" />
            <set name="HTTP_X_FORWARDED_HOST" value="{HTTP_HOST}" />
            <set name="HTTP_X_REAL_IP" value="{REMOTE_ADDR}" />
          </serverVariables>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
