Our internal web server is running IIS, with the main site powered by aspNetCore and launched as MainWeb.exe.
We would like to deploy a new REST API built with Quarkus as a native image (quarkus-rest-api.exe) and run it on the same web server. Is it possible to execute quarkus-rest-api.exe using IIS as a reverse proxy via HttpPlatformHandler?
The services are configured to run on the following ports:
- Main site: Port 80
- API: Port 8080
We want the URLs to be as follows:
- Main site:
http://10.1.1.2/ - API:
http://10.1.1.2/api
The following components have already been installed:
- httpPlatformHandler_amd64.msi
- requestRouter_amd64.msi
- rewrite_amd64_ja-JP.msi
Directory Structure:
D:
├MainApp
│ ├・・・
│ └web.config
└QuarkusAPI(sub application)
├・・・
└web.config
Main Site web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<httpErrors errorMode="Detailed" />
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\MainWeb.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
<rewrite>
<rules>
<rule name="QuarkusAPI" stopProcessing="true">
<match url="^api/(.*)" />
<action type="Rewrite" url="http://localhost:8080/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
</configuration>
Sub-application web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="QuarkusAPIHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="D:\QuarkusAPI\quarkus-rest-api.exe" stdoutLogEnabled="true" stdoutLogFile="D:\QuarkusAPI\logs\stdout.log" startupTimeLimit="600">
</httpPlatform>
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>
attempt:
attempt 1:
When accessing the API with the above configuration, no response is returned. It seems that HttpPlatformHandler is not working, and quarkus-rest-api.exe is not being executed.
- URL: http://10.1.1.2/api
attempt 2:
However, when I manually execute quarkus-rest-api.exe and disable both the sub-application and HttpPlatformHandler, the API responds correctly.
- URL: http://10.1.1.2/api
attempt 3:
When I kept the sub-application's web.config settings unchanged and modified the url in the Rewrite section of the main site's web.config as follows, the HttpPlatformHandler worked correctly:
<action type="Rewrite" url="/api/{R:1}" logRewrittenUrl="true" />
Question:
Is it possible to configure both rewrite and httpPlatform at the same time? If so, how can I achieve this?
Would it be a more common and appropriate approach to manage quarkus-rest-api.exe using a Windows Service + IIS reverse proxy setup, rather than HttpPlatformHandler, to keep it running at all times while handling reverse proxy functionality?
If anyone could help me resolve this issue, I would greatly appreciate it.