IIS 7 + Tomcat 7 – how to reach http://localhost:8080/the_app under e.g. http://the_app.local

iisiis-7iis-7.5javatomcat

In brief:

IIS 7 + Apache Tomcat 7 + isapi_redirect.dll:

I have a deployed and working Tomcat-application available under http://localhost:8080/my_app.
I would like to see the same content under http://my_app.local (and NOT the default Tomcat-site [which you can see below]).
I set up isapi_redirect.dll, so right now my_app.local's content equals to localhost:8080's, but it's not enough, I would like to map localhost:8080/my_app under my_app.local.
(I DO have 127.0.0.1 my_app.local in hosts file, so I can already open my_app.local, BUT now it only shows the default Tomcat site (same as available under http://localhost:8080)).

Please read what I have already tried:


Longer explained:

I have IIS 7 (7.5.7600.16385) and Apache Tomcat/7.0.22 installed.

  1. I deployed an application (let's call it "my_app") in Tomcat,
    which now can be reached at http://localhost:8080/my_app, works
    fine. I added a new web site in IIS panel with the path of the
    Tomcat deployed my_app, which looks like this: "c:\Program
    Files\Apache Software Foundation\Tomcat 7.0\webapps\my_app
    "
  2. I binded the host name my_app.local.
  3. After that, I configured isapi_redirect.dll like this (or
    that).
  4. Now, when I open http://my_app.local, I can see the default Tomcat
    site (see below), which is the same as the content under http://localhost:8080/!! (That's the problem!!!)
  5. BUT under http://my_app.local I would like to see the same content as
    under http://localhost:8080/my_app.

How can I do that? Thank you very much in advance!!

my config files:

enter image description here



UPDATE

I found this too: http://tomcat.apache.org/connectors-doc/generic_howto/proxy.html

Case B: You need to hide path components for all requests going to the
application. Here's the recipe for the case, where you want to hide
the first path component /myapp. More complex manipulations are left
as an exercise to the reader. First the solution for the case of
Apache httpd:

  1. Use mod_rewrite to add /myapp to all requests before forwarding to the backend:
    […]
  2. Use mod_headers to rewrite any HTTP redirects your application might return.
    […]
  3. Use mod_headers again, to rewrite the paths contained in any cookies, your application might set.
    […]

If you are using Microsoft IIS as a web server, the ISAPI plugin provides a way of doing the first step with a builtin feature. You
define a mapping file
for simple prefix changes like this:

# Add a context prefix to all requests ...
/=/myapp/
# ... or change some prefix ...
/oldapp/=/myapp/

and then put the name of the file in the rewrite_rule_file entry of
the registry or your isapi_redirect.properties file. In your
uriworkermap.properties file, you still need to map the URLs as they
are before rewriting! […]
There is no support for Steps 2 (rewriting redirect responses) or 3 (rewriting cookie paths).

I was surprised that it writes "There is no support for Steps 2 (rewriting redirect responses) or 3 (rewriting cookie paths).", I don't know if it's still true, but then what? Am I stuck again?

Best Answer

Depending on your goal (easy to remember url?), maybe it's ok to just redirect my_app.local -> my_app.local:8080/my_app?

This would not hide the target site, however.

Setup a new IIS Site at my_app.local, and let it redirect to your :8080/my_app app.

http://technet.microsoft.com/en-us/library/cc732930(WS.10).aspx