I am in the process of writing a servlet that acts as a proxy where I can modify request post parameters and thought I better check and see if I am trying to reinvent the wheel.
I see there are proxies like mod_proxy that can be used to connect Apache to Tomcat and I also saw Tomcat virtual hosts, but i am not sure that either of these can handle what I am trying to do. I want to be able to modify the request sent by the client and then forward it to the target server. I also want to be able to modify the response sent back by the target server and then forward it back to the client. Client Browser -> Proxy (modify request) -> Target Server Target Server -> Proxy (modify response) -> Client Browser Other requirements: 1. I do not want to use an Apache/Tomcat combination, Tomcat only. 2. The Proxy and Target Server are two different applications (contexts) that may be running in the same instance of Tomcat or may be on two different physical servers at different locations across the Internet. The solution needs to work in both of these scenarios. 3. It needs to accommodate any rewriting of headers with host info in them like 302 redirect Location headers. My current solution uses a combination of a Servlet Filter that wraps the request and response, so I can modify them, and then passes it to a proxy servlet. I have it working pretty well as long as the proxy servlet is run as the ROOT app in one instance of Tomcat and the target server runs in another instance of Tomcat. The minute I try to run the proxy servlet with a context path or run the proxy servlet and the target app in the same Tomcat instance, I run into an evil 302 loop with the target server app or a loop with the proxy itself. I thought I better check and see if there is a better way of doing all of this before I spend any more time coding for these situations. -- Thanks, Warren Bell --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org