0

I have a http service running on localhost port 8080 on a centos 7 machine. Is there any way I can route / port forward incoming and outgoing traffic through my external interface. So, mapping 127.0.0.1:8080 to <my external ip address>:8080?

I'd also like to do the same with https if possible as well.

I don't have access to the application code, so would prefer an iptables / port forwarding solution if possible.

  • 1
    Does this answer your question? [How can I forward requests from my web server?](https://serverfault.com/questions/1035016/how-can-i-forward-requests-from-my-web-server) – Gerald Schneider Jun 24 '22 at 11:37
  • Or you could just bind it to the external interface as well ... – Gerald Schneider Jun 24 '22 at 11:37
  • I don't really have the application code available, so was wondering if i could do something with iptables – WhatTheWhat Jun 24 '22 at 11:39
  • @GeraldSchneider We shouldn't encourage people to expose localhost, mapping to external is the right way to go so it can be separated from internal work – Chopper3 Jun 24 '22 at 11:39

1 Answers1

0

The REDIRECT target is probably the answer:

https://www.frozentux.net/iptables-tutorial/iptables-tutorial.html#REDIRECTTARGET

Dylan
  • 441
  • 2
  • 6