# How to Set Up Reverse Proxy with Windows IIS for Oracle APEX?

# Introduction

In this tutorial, we will discuss the steps to set up a reverse proxy for Oracle APEX using Microsoft IIS (Internet Information Service).

Please note that this guide is intended for educational purposes only. In a production environment, additional steps may be necessary to adequately secure the applications.

# Use Case

Your organization hosts an APEX application, and you aim to enhance its security by implementing SSL encryption and obscuring the actual port numbers on which the application runs.

# Assumptions

* ORDS is running either in standalone mode or deployed in Apache Tomcat.
    
* ORDS is accessible on port 8080.
    
* The DNS record for your domain has already been added and is pointed to the reverse proxy server.
    

# Video Tutorial

%[https://youtu.be/sHsEj_Xf_2Q?si=Hf1WMqWqVaMvNigg] 

# Steps

Setting up a reverse proxy with IIS involves five steps, as listed below.

1. Install IIS
    
2. Install Microsoft Application Request Routing Module
    
3. Install Microsoft URL Rewrite Module
    
4. Enable Reverse Proxy
    
5. Configure Trusted Origins
    

Watch the video tutorial and follow the steps to set up a reverse proxy.

1. ## Install IIS
    

* Open Server Manager
    
* Select "Add roles and features"
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710779672518/e6394a5b-b5b5-474d-953c-cfd2436b2a47.png align="center")
    
* Click Next and select "Role-based or feature-based installation" and click Next.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710779771141/9ddce666-9b49-427a-a879-757abb1f9d19.png align="center")
    
* Select "Web Server (IIS)" from Server Roles
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710779827371/716aee44-3ad6-4ada-bf3a-61673413f22d.png align="center")
    
* Click Next and Click "Add Features"
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710779871720/5391f293-65c9-4299-a348-7e8f57625912.png align="center")
    
* Click 'Next' until you reach the last step of the wizard, and the installation will commence.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710779978045/b8a2fb5d-e268-4052-8642-17f8a96c6b51.png align="center")
    

Once the installation is complete, check the server status by opening '[localhost](http://localhost)' in a browser.

2. ## Install Microsoft Application Request Routing Module
    

* Download Microsoft Application Request Routing from [https://www.iis.net/downloads/microsoft/application-request-routing](https://www.iis.net/downloads/microsoft/application-request-routing)
    
* Install the module.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710780402380/650c4907-eff4-4e65-8065-2ce4df3d6d0a.png align="center")
    

Verify the installation by opening the IIS Manager

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710780460178/7c5ffaed-2f09-4388-b762-7511b1b5d048.png align="center")

3. ## Install Microsoft URL Rewrite Module
    

* Download the URL Rewrite module and install it. [https://www.iis.net/downloads/microsoft/url-rewrite](https://www.iis.net/downloads/microsoft/url-rewrite)
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710780599605/f39ea7d8-f024-4b4d-a375-0bde93ecc8d7.png align="center")
    
* Verify the installation from the IIS Manager.
    

4. ## Enable Reverse Proxy
    

* Open IIS Manager
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710780981569/bf688a0c-0230-4c44-ae41-d6a1d7d4c261.png align="center")
    
* Open your site
    
* Open URL Rewrite module
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781012637/712458e4-782e-4229-8d2f-5ba55d22c331.png align="center")
    
* Click "Add Rules" under actions.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781016587/e9e935bc-c752-4f65-98d9-f6a0700a194e.png align="center")
    
* Select "Reverse Proxy" and click OK.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781031485/b0164fbe-10e6-48e0-877b-e9cd62d4a206.png align="center")
    
* Set the rules as shown in the screenshot.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781070897/91d66842-947e-42a4-84b2-38123eb653d8.png align="center")
    
* You have enabled Reverse Proxy. Let's verify by typing the domain in the browser. You will see that the APEX application is loading without the need to specify the port number.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781076389/b5faed71-c0b0-4cbf-aa51-30c62ed07554.png align="center")
    

5. ## Configure Trusted Origins
    

* If you attempt to log in to Oracle APEX, you may encounter the following error. To resolve this, add your domain to the trusted origins in the ORDS configuration file.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781329359/9943a27a-5407-4e59-8850-c7da1c23caa8.png align="center")
    
* Open the ORDS configuration file from {ORDS Config Directory}/global/settings.xml
    
* Add your domain to the trusted origins list and save the file.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781437760/36a29a80-d337-4ddb-b57b-2d7f285b6048.png align="center")
    
    ```xml
    <entry key="security.externalSessionTrustedOrigins">http://example.com,https://example.com:443</entry>
    ```
    
* Restart ORDS and verify the setup by logging into Oracle APEX Workspace.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781544975/69fbcf9c-e478-42bb-b13c-51bfa2b33bfd.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710781560408/3d0b73dc-af04-4cf4-992a-f7ff6127da0f.png align="center")
    

# References

* [https://learn.microsoft.com/en-us/iis/get-started/introduction-to-iis/iis-web-server-overview](https://learn.microsoft.com/en-us/iis/get-started/introduction-to-iis/iis-web-server-overview)
    
* Application Request Routing: [https://www.iis.net/downloads/microsoft/application-request-routing](https://www.iis.net/downloads/microsoft/application-request-routing)
    
* URL Rewrite: [https://www.iis.net/downloads/microsoft/url-rewrite](https://www.iis.net/downloads/microsoft/url-rewrite)
    
* ORDS Configuration File: [https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/23.4/ordig/about-REST-configuration-files.html#GUID-006F916B-8594-4A78-B500-BB85F35C12A0](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/23.4/ordig/about-REST-configuration-files.html#GUID-006F916B-8594-4A78-B500-BB85F35C12A0)
