# IIS (10) Reverse Proxy

## 1. Install IIS Role on Windows (Server)

1. Open Server Manager
2. Go to Manage -&gt; *Add Roles and Features*
3. Select *Role-based or feature-based installation*
4. Select your Server
5. Enable *Webserver (IIS)*
6. Click Next until the Assistant is done

## 2. Install *ARR* and *URL Rewrite* Module

The "Application Request Routing" Module is required for the Reverse Proxy Behavior

- Download ARR from: [Here](https://www.iis.net/downloads/microsoft/application-request-routing) and Install it.
- Download URL Rewrite from: [Here](https://www.iis.net/downloads/microsoft/url-rewrite) and install it

After that, start `cmd.exe` as Administrator and run `iisreset`

## 3. Enable ARR in IIS Manager

1. Start the IIS Manager Application (Server Manager -&gt; Tools -&gt; *Internet Information Services (IIS) Manager*)
2. Click on your Server and Select *Application Request Routing Cache*
3. On the right side, click *Server Proxy Settings* and check *Enable Proxy*

## 4. Setup Reverse Proxy Rule

1. Open or create your Site
2. Click on *URL Rewrite*
3. On the right side, click *Add Rule(s)*
4. Select *Blank rule* at *Inbound Rules*
5. Give your Rule a Name 
    - Pattern  
        Use a Regex Pattern here that matches whatever URL you want to r' proxy  
        Example: Everything after the URL: `^(.*)$`
    - Action  
        Rewrite URL is your Target Webserver  
        With the Pattern specified above, it will capture a Part of it using Regex. With the Example, everything after your URL.  
        With this, an example Rewrite Url would be: `http://localhost:16666/your-application/{R:1}`  
        `{R:1}` is your first captured result.
6. Apply and restart your Site.