Monday, May 2, 2011

Port Forwarding (80 to 8080 for Tomcat) Using IPFW on Mac OSX

Here I show how easy it is to set up port forwarding (80 to 8080 for Tomcat) on Mac OSX using ipfw from the Terminal. IPFW is the built-in firewall of Mac OSX and we can quickly set up a firewall rule to allow port forwarding...


Step 1: View current firewall rules.
sudo ipfw show

Step 2: Add port forwarding rule (80 to 8080 for Tomcat)
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in

If you want to remove your firewall rules run:
sudo ipfw flush


Piece of Cake!!!

5 comments:

  1. Thanks for this post!

    Also make sure your web sharing is off in the sharing settings.

    ReplyDelete
  2. Thanks for this. Exactly what I needed to do...

    ReplyDelete
  3. Any idea how to do the same with PF?

    I'd like to forward all http traffic to port 8080 on a another(Proxy) machine.

    Richard

    ReplyDelete
  4. I tried ipfw to forward 80 to 8080 at mydomain.com also, but no cigar.

    Here's the command:
    ipfw add 100 fwd mydomain.com,8080 tcp from any to any 80 in.

    ReplyDelete