proxy – Nginx listens on any port but rewrites on 8080

I've set up a nginx proxy with Openresty. The proxy takes an HTTP POST SOAP request, modifies it with the help of an LUA script written to the root ("/") location of the HTTP server on port 8080 and sends it to a main server for processing, which works correctly.

When the proxy relays the connection to the primary server, it creates a new TCP-compliant connection that generates a new source port other than 8080 that the primary server must respond to.

Is there a way to intercept the reply on nginx, so that it can intercept such a response and modify it accordingly, with an LUA script?

Thank you for all the ideas you may be able to provide.