Can not start endpoint on null:80 due to exception java.net.BindException: Permission denied
The problem is that on UNIX-type operating systems, only user root may bind to listen on port 80. All other users are considered non-privileged and they cannot bind to that port [1]. Web server standardly runs on port 8080. The solution is either run the web server as root (BLEH) or try something different. In the described solution we are forwarding all requests on port 80 to port 8080. To set up port forwarding we will be using ipfw.
First, we forward local requests from port 80 to port 8080:
sudo ipfw add fwd 127.0.0.1,8080 tcp from any to 127.0.0.1 80 in
The syntax of this command is somehow confusing. What this says is, "if tcp packets come (from anywhere) destined for port 80 on 127.0.0.1, forward those packets to port 8080 on 127.0.0.1". [2]
Then, if needed, we forward all outside requests for port 80 to 8080:
sudo ipfw add fwd 127.0.0.1,8080 tcp from any to [hostname] 80 in
For solution on Linux search for iptables. A sample solution can be found here: Running network services as a non-root user.
No comments:
Post a Comment