The initial configuration needs to be performed with privilege to use the sudo command. Alternatively login as root and execute the same without sudo.
sudo iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 8080 sudo iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 8443
Will route port 80 to 8080 and 443 to 8443. Your app can now bind to port 8080 and/or 8443 without needing elevated privileges.
It was the technique I used for the Google OAuth Reverse Proxy, a part of my Garage Door Opener architecture.
How do you undo? Call the same commands again substituting -A (append) for -D (delete).
No comments:
Post a Comment