tejoe
tejoe

Reputation: 171

Forward requests from tomcat to another server

I have a tomcat providing a web application war. Pages of that application are directly available via tomcat, so we do not have an httpd. Direct Access is possible using the url: http://<host>:<port>/myapp/

Now I want to include another service, which is actually available on another host, due to firewall, this other host is not accessible directly.

Is it possible to configure tomcat to forward calls to http://<host>:<port>/myapp/external-service to that other server (e.g. http://<other-host>:<port>/external-service).

Actually I need the almost same behaviour, what the mod_proxy of httpd would provide with the following configuration, but without using the an httpd

ProxyPass         /myapp/external-service  http://<other-host>:<port>/external-service
ProxyPassReverse  /myapp/external-service  http://<other-host>:<port>/external-service

Can I achieve the same behaviour, with either a tomcat configuration or a servlet configuration? Even if you do not know the answer, maybe you can give a hint, what settings to look for. Currently I do not even know, what to search for.

Upvotes: 1

Views: 1053

Answers (1)

Mark Thomas
Mark Thomas

Reputation: 16660

No. Tomcat does not provide reverse proxy functionality. You might be able to find a library that provides it but I am not aware of any. You code code it yourself but reverse proxies are non-trivial to write. I'd recommend revisiting the decision not to use httpd - it is likely to be the simplest approach.

Upvotes: 0

Related Questions