Port Redirect on Mac OSX Mavericks

For local development on my Mac I wanted to be able to not have to add a port after my development URL for http/https. I've done this on Linux before with iptables but didn't know if that was even a thing for OSX.

Turns out the command isn't that complicated here is how you can accomplish it.

This will redirect all traffic to port 8080 to 80:

sudo ipfw add 100 fwd,8080 tcp from any to me 80

And for redirecting all traffic from 8443 to 443:

sudo ipfw add 101 fwd,8443 tcp from any to me 443

The one downside to this method (which I didn't realize immediately) is that your changes will be lost when you reboot. I am sure there is a way to persist this, but I am not sure what that is, but you could probably just write a startup script to do this as well.