IIS Reverse Proxy Fails without Trailing Slash

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 http://127.0.0.1:8080/app/{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: http://127.0.0.1:8080/app/{R:1}