IIS (Internet Information Services) · Advanced IIS

Reverse Proxy with ARR

IIS can be the front door for apps that run their own web server — Node.js on port 3000, a Java app on 8080 — adding HTTPS, logging and one public address.

Advanced 5 min Lesson 34 of 45Covers IIS 10 on Windows Server 2019/2022/2025 and Windows 10/11.
Before you start:URL Rewrite
0/45 in IIS
On this page · 5 min · Advanced

Learning objectives#

  • Enable the ARR proxy
  • Create a reverse proxy rule
  • Preserve the host header and client IP
  • Proxy only one path

Explanation#

Install URL Rewrite and Application Request Routing (ARR). Then on the server node: Application Request Routing Cache → Server Proxy Settings → tick Enable proxy → Apply. Nothing is proxied until this is on.

On the site: URL Rewrite → Add Rule(s) → Reverse Proxy. Enter localhost:3000 and IIS writes a rewrite rule to http://localhost:3000/{R:1}. Tick “Enable SSL Offloading” so the back end receives plain HTTP while visitors use HTTPS.

The back end sees requests coming from IIS. ARR adds X-Forwarded-For with the client IP; set preserveHostHeader so the app sees the original Host. Configure the app to trust these headers (for Express: app.set('trust proxy', 1)).

A pattern such as ^api/(.*) proxies only /api to the back end while IIS serves the rest (for example a React build) itself.

Step-by-step screens#

Drawings of IIS Manager in IIS 10 (Windows Server 2019/2022, Windows 10/11). The red numbers match the numbered actions under each picture; names on your computer will differ.

Loading pictures…

Code example: Proxy /api to a Node.js server#

XMLweb.config Illustrative
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Proxy API to Node" stopProcessing="true">
          <match url="^api/(.*)" />
          <action type="Rewrite" url="http://localhost:3000/api/{R:1}" />
          <serverVariables>
            <set name="HTTP_X_FORWARDED_PROTO" value="https" />
          </serverVariables>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>


<!-- once per server (run in an elevated prompt):
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/proxy /enabled:"True" /preserveHostHeader:"True" /commit:apphost
-->
Expected output
https://shop.example/api/products is answered by the Node.js app on port 3000; everything else is served from the site folder by IIS.

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. The rule matches only URLs starting with api/.
  2. Rewrite (not Redirect) forwards the request internally.
  3. X-Forwarded-Proto tells the app the visitor used HTTPS (add the variable to the allowed server variables list first).
  4. appcmd enables the proxy and keeps the original Host header.

Real-world use case#

A team on Windows Server runs a Node.js API and a React front end on one domain: IIS serves the React files, handles the certificate, and proxies /api to Node.

Common mistakes#

Rule added but proxy not enabled

IIS returns 404 for the proxied path. Enable proxy in Server Proxy Settings.

Setting server variables that aren’t allowed

IIS returns 500.50. Add them under URL Rewrite → View Server Variables first.

Best practices#

  • Proxy only what needs it
  • Terminate HTTPS at IIS
  • Forward client IP and protocol
  • Keep the back end listening on localhost only

Remember this#

ARR → Server Proxy Settings → Enable proxy.

Rewrite to http://localhost:port/{R:1}.

X-Forwarded-For = real client IP.

Practice exercise#

Your task: Write the rewrite action that forwards everything to http://localhost:8080.

Show solution
XML Illustrative
<action type="Rewrite" url="http://localhost:8080/{R:1}" />

Mini quiz#

Reverse Proxy with ARR quizMultiple choice Question 1 of 1

Which IIS modules are needed for a reverse proxy?

Score so far: 0/0

Want more? Practise all IIS MCQs · IIS interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.