• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Port Forwarding

Sysop

Basic Pleskian
How can I forward certain IP traffic coming from port 80 to another port on my server (eg. Port 7272)?

Screen Shot 2021-04-30 at 12.34.48 PM.png
I tried to do this from within Plesk Firewall but I get an error stating "Invalid IP address or network." (eg. Destination IP = 25.25.25.25:7272).
 
You could try and use something like:

Additional nginx directives

Code:
location = / {
return 301 https://domain.tld:7272;
}

I hope it helps.
 
Better to use proxy_pass for a transparent redirect.
Also, this will probably conflict with redirect to https if that is active in nginx. Port redirecting by firewall would still work because it catches the packets before nginx.
 
Better to use proxy_pass for a transparent redirect.
Also, this will probably conflict with redirect to https if that is active in nginx. Port redirecting by firewall would still work because it catches the packets before nginx.
I was wanting to use the firewall although when i installed firewalld it conflicted with the Plesk firewall, so I’m not quite sure how to handle that.

Do you have an example of the nginx directive to use proxy pass in the way you describe?

Thanks!
 
I was wanting to use the firewall although when i installed firewalld it conflicted with the Plesk firewall, so I’m not quite sure how to handle that.

Do you have an example of the nginx directive to use proxy pass in the way you describe?

Thanks!
Note: there's been three different solutions mentioned.

a) a redirect - this will receive an HTTP request, and respond with a location header asking the browser to access the new URL. Likely not what you want.
b) a HTTP proxy - this was receive the HTTP request, and send that same request to the server you're proxying to, then return that response to the browser. Ths can act as a "port forwarder" - but this only operates on an application level, in this case, HTTP.
c) port forwarding can also be done at a lower level that'll pass all, or some connections to the port. IPTables is a great solution for this: Linux Port Forwarding Using iptables - SysTutorials. This is the solution you want if you're not forwarding HTTP traffic

The implication for c) is that all traffic that matches the rule will get forwarded. Since you're on 80, all HTTP traffic will be forwarded to 7272, whether you want to or not. Therefore, if you've also got Apache listening on the IP you want to port-forward, Apache will no longer server the requests as the firewall steps in before Apache even gets the request.
 
Back
Top