I came to know there are multiple ways to set up the IIS server as a proxy but not sure which option is suitable for my case.
I want to use my IIS server as a proxy server to access my application running on Tomcat. The reason is, my IIS is running on a secure port. This port is already opened and I want to utilize it.
I tried reverse proxy in IIS. It routes the traffic but I noticed two issues.
- It changes the address on the address bar (I see my Tomcat application address + port in the address bar) although I set the option to Rewrite while setting up the proxy.
- It does not work well if I do not append the forward slash at the end of my URL.
My IIS server has some other applications hosted as well. I do not want to disturb other applications. So I created an empty web application (e.g. https://myserver/myapp/) and set up a reverse proxy on it.
This is my reverse proxy rule;
Please correct me if this is the right approach. If yes am I missing anything?
Edit 1
I have tried HttpPlatformHandler. It is giving 502.3 Bad Gateway. Here are my configurations in web.config file.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="C:\Program Files\Apache Software Foundation\Tomcat 9.0_x\bin\startup.bat" arguments="" stdoutLogEnabled="true" stdoutLogFile="c:\dev\javasites\log.txt">
<environmentVariables>
<environmentVariable name="JRE_HOME" value="C:\Program Files\AdoptOpenJDK\jre-8.0.232.09-hotspot" />
<environmentVariable name="CATALINA_HOME" value="C:\Program Files\Apache Software Foundation\Tomcat 9.0_x" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
--- log.txt -----
Using CATALINA_BASE: "C:\Program Files\Apache Software Foundation\Tomcat 9.0_x"
Using CATALINA_HOME: "C:\Program Files\Apache Software Foundation\Tomcat 9.0_x"
Using CATALINA_TMPDIR: "C:\Program Files\Apache Software Foundation\Tomcat 9.0_x\temp"
Using JRE_HOME: "C:\Program Files\AdoptOpenJDK\jre-8.0.232.09-hotspot"
Using CLASSPATH: "C:\Program Files\Apache Software Foundation\Tomcat 9.0_x\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 9.0_x\bin\tomcat-juli.jar"