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.
- I deployed an application (let's call it "
my_app
") in Tomcat, which now can be reached athttp://localhost:8080/my_app
, works fine. I added a new web site in IIS panel with the path of the Tomcat deployedmy_app
, which looks like this: "c:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\my_app
" - I binded the host name
my_app.local
. - After that, I configured
isapi_redirect.dll
like this (or that). - Now, when I open
http://my_app.local
, I can see the default Tomcat site (see below), which is the same as the content underhttp://localhost:8080/
!! (That's the problem!!!) - BUT under
http://my_app.local
I would like to see the same content as underhttp://localhost:8080/my_app
.
How can I do that? Thank you very much in advance!!
my config files:
- isapi_redirect.properties (I made a dir junction to c:\tomcat, so this also works :) )
- workers.properties
- uriworkermap.properties
- rewrites.properties (empty)
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:
- Use mod_rewrite to add /myapp to all requests before forwarding to the backend: [...]
- Use mod_headers to rewrite any HTTP redirects your application might return. [...]
- 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 yourisapi_redirect.properties
file. In youruriworkermap.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?
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
Can you try this: http://blogs.iis.net/carlosag/archive/2010/04/01/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx
This seems to be what you need, URL Rewriting & Application Routing.