0

Can I use single HTTP port 80 to port forward to multiple ports running on the same machine?

And to which port the request need to be forward shall be sent via request parameter or HTTP header.

Actually, I am trying to establish a connection to a server listening on multiple ports for various operation hosted on AWS from my machine available in a corporate network.

Our corporate firewall blocks any outbound ports except standard ports like 80, 443.

So, want to check of using port forwarding capabilities HTTP 80 port to multiple ports and resolve destination port from some HTTP header value.

2
  • You can do what you describe only if the application running on 80 is designed to do this, by allowing some kind of higher layer addressing from which you can determine which service to send to. For instance, HTTPD's can run multiple sites on one IP, and distinguish between them by the domain in the URL, or in the case of HTTPS, via SNI information in the server binding configuration and the SNI information in the request. But that means that the daemon on 80 (and likely the other daemons as well) needs be written to accommodate that behavior. Jun 29, 2017 at 12:26
  • You should be able to do it with Apache. In the virtual host for port 80, set a variable from wherever you want to put the port number, then use a reverse proxy redirection to the host with correct port number. I don't have any reference material at hand, so I can't point you to the actual commands to do it - I'll try to do it later. Jun 29, 2017 at 13:04

1 Answer 1

2

This is typically called "proxying".

You would setup a server listening on port 80 - this would then handle all incoming requests, and can pass them on to other HTTP servers (local or remote) depending on any of a number of things including:

  • Hostname (e.g: Host: example.com HTTP header)
  • URI (e.g: /api could forward to the Python backend)
  • Client IP

Have a look at the nginx or apache configuration manuals for a good start.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .