I have IIS with URL Rewrites acting as a reverse proxy to Apache Tomcat.

example.com/app/ redirects to example.com:8080/app/. Port 80 redirects to port 8080 on the same server.

If I go to example.com/app/ it works as expected. However, if I go to example.com/app (without the trailing slash), it results in a 404 error.

The pattern I'm matching for the Inbound Rule is ^app/(.*). Then the action rewrites to the URL{R:1}.

Any suggestions on how to get this to work without the trailing slash?


I had a similar issue and manage to fix it by creating two rules

  1. 301 Redirect

search pattern: ^app$

redirect URL: app/

  1. rewrite

search pattern: ^app/(.*)

rewrite URL:{R:1}


To elaborate on Thomas's answer, here is the config file after the rules have been created:

<?xml version="1.0" encoding="UTF-8"?>
                <clear />
                <rule name="ReverseProxyInboundRule2" stopProcessing="true">
                    <match url="^app$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Redirect" url="app/" />
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Rewrite" url="http://localhost:8080/{R:1}" />

I believe it could work with a solution I used for a similar issue. In your case, the search pattern would be:


and the Rewrite URL would be:{R:1}

Notice that there is no

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.