0

I'm new in this forum, I thought I could ask a question here. I've set up a proxy by using nginx and Openresty, which supports LUA scripts, that changes the body of a HTTP SOAP POST request.

The problem I have, is that when the connection is being created, it passes through a proxy by using port 8080 but, when it's relayed, the source port changes (e.g. on port 54321), and thus the relative response of the underlying server.

Is there a way for the proxy to keep the connection on a specific port when it relays the request, so I can also modify the response of the server (e.g. on port 8090)?

I appreciate any insights you may be able to provide.

1
  • Unfortunately, questions about host/server configurations are off-topic here, as are questions about protocols above OSI layer-4. You could try to ask this question on Server Fault for a business network.
    – Ron Maupin
    Dec 11, 2018 at 13:13

1 Answer 1

0

You can't tie and knit these TCP sessions together. A proxy terminates the one TCP session from the client, opens another one to the server and passes data in between. The "source port change" indicates another session.

A proxied TCP connection differs from a NATed one in that respect - NAT changes the port numbers, a proxy uses a second connection.

2
  • Hi Zac67, thanks a lot for your reply. So - in other words, to your knowledge - there's no way at all to achieve what I'm trying to do? Thanks
    – Alessandro
    Dec 11, 2018 at 10:21
  • I'm not completely sure what you're trying to achieve. It certainly is possible to modify a SOAP request on the proxy but you should leave everything else as is - accept the client connection, establish another server connection, pass data in between, filter as required (I actually once built a tiny SMTP and a TCP 'proxy' in Python to change a few server options 'in flight').
    – Zac67
    Dec 11, 2018 at 17:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.