I have two web servers A
and C
. Because of rules, policies etc A
cannot communicate directly with C' (
Crequires requests to have special security headers and
A` does not support this)
I want to create a "proxy" called B
in Java, to facilitate communication between A
and B
but I having trouble with it conceptually.
When you create a proxy, don't you have to change the hard coded URLs on all your services to now travel through the proxy? And then I suppose you must pass your destination as a query parameter somehow, for example
http://proxy.com/?destination=mydestination.com
Is this how a proxy would work?
(I have found a few similar questions but they do not resolve the fundamental question I am having i.e. How packets reaches Destination throgh proxy servers?)
Don't write your own proxy from scratch that will be a redo, there are a plenty of proxy implementations out there
Spring framework
Standard Servlet
in case if you are intrested in how you can build up your own proxy , here is a simple example using spring framework (Servlet implementation is not that far from spring implementation)
the example above is a start point on how to implements HTTP proxy or how it is working there are many things to cover which is droped off like security for instance