I've got a following setup:
Application A - makes HTTP requests to some API, running on http://localhost:8090.
Application B - intercepts HTTP request from A, a proxy running on http://localhost:8080.
Is it possible to force HTTP traffic from one application to another app running on the same host?
I've been trying something like that:
iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 8080
But it seems it works only if the destination of HTTP request is some external API, it is not working if API resource server is deployed also on localhost (I suspect this is due to --dport 80). I don't know much about iptables, but something like that is even possible? If so, how can I accomplish this?