1

In order to make an application compatible with our SSO implementation I need to handle an HTTP request (which adds some HTTP headers) and then "forward" that request to another web server (3rd party web server).

[Browser]-->[MyProxyApp on Tomcat]-->[Another Webserver]

Is Tomcat able to "forward" (reverse-proxy) requests to another server?

Simplest way I can think of is a servlet that implements an HTTPClient, but I was hoping for a simpler solution.

"Noodle" seems to do the job, but given it's age, I'm not sure it's 100% compatible with the current web standards (websockets, longpolling and such things)

2
  • Not by using Tomcat or Servlets. You need to write Sockets code. Using a Servlet would add far too much latency, even if you could get it to work, which is problematic. Or use Apache HTTPD, which makes it trivial. Commented Feb 5, 2017 at 21:40
  • Yea, I'd use apache, but I have some Java code that needs to run, I don't want to put that into an apache module. Latency is not an issue - I mean it is not expected to perform well. Commented Feb 6, 2017 at 9:40

1 Answer 1

1

There is an active github project which has been around for a while:

https://github.com/mitre/HTTP-Proxy-Servlet

It is implemented as a Java Servlet based on HttpClient, probably exactly what you thought of, but maintained and available in the Maven repos

https://mvnrepository.com/artifact/org.mitre.dsmiley.httpproxy/smiley-http-proxy-servlet

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.