File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes webapp as proxy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "webapp as proxy" Watch "webapp as proxy" New topic

webapp as proxy

Robert Garrido
Ranch Hand

Joined: Dec 11, 2008
Posts: 30

I have 6 different web-apps (let's call their contexts /wa1, /wa2 ... /wa6) running in port 8080.

I have another web-app named /proxy running on port 80. As the name suggests this web-app does proxy functions for the other 6 web-apps. This proxy basically is meant to go to any of the web-apps and follow any number of redirects until a final page is reached, so external clients always get the needed resource in one shot.

For instance, a client requests: http://hostname:80/wa1/resourcex, then the request should actually go to http://hostname:80/proxy, after that the proxy makes all calls following redirects to http://hostname:8080/wa1/resourcex (where the actual web-app context runs) and returns the final result to the client.

I can't modify any of the 6 original webapps, however I can do whatever I want with the proxy one. How can I get this done?

Please assist. Thanks in advanced!
Ankit Garg

Joined: Aug 03, 2008
Posts: 9462

I don't know if this can be done or not (or if it is the right way or not), but I think you'll have to run your proxy as ROOT in your Tomcat (if you are using tomcat) i.e. your proxy should run on the default/root context. I assume that your server on port 8080 and 80 are different. I also know of ngnix if that would be useful (it was used on one of my earlier sites that I worked on but I don't know much about it)...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: webapp as proxy
jQuery in Action, 3rd edition