4D’s web server & port 80 – Part I

Just had to fight on MacMini Server (10.6.4) with the firewall and port 80. 4D does some kind of work with its „Helper Tool“, but I found it is not reliable.

The 4D manual is not really uptodate… and has a trap. The picture shows „Enable SSL“ but does not tell you anything about the required certificates you need. Without the certificates SSL will not work – 4D’s listener on port 443 does not start. This is a different problem, we will cover it later.

Setting the firewall seemed to be the solution. Used to the user friendly interface of Apple, what a bummer! No such things for the server software.

I tried to use ‚WaterProof‘ – it destroyed the IP v6 settings and rendered the server useless. Thanks to TimeMachine I was able to recover from this.

First, you have to turn on the firewall. Sounds easy? Yep, but right in the beginning easy to forget.

Test your settings

Start the terminal and enter this line.

sudo ipfw add 101 fwd,8080 tcp from any to any 80 in

You have to get used to the syntax.

sudo Run it with root permission

IPfirewall – the program which executes your line

add ‚add‘ a new rule

101 Each rule is numbered, executed to to down, first match wins

fwd forward – you want to forward an incoming TCP packet

<ip address>,<port number> this is the final destination where you packet should go to. It is the IP address 4D’s web server is listing to (see 4D’s web server prefs). Take care: If you have assigned multiple IP addresses to your Mac and 4D listens not to all, then you need to replace with the IP address 4D’s web server is listening to!!

tcp protocol, use TCP always and only

from any 2 commands, but you don’t care (usually) where the packet is coming from

to any The tricky part starts here.

  • if you run with a single ip address, you are done
  • if you have more the one and 4D listens to all then you are done, too
  • if you have more the one ip address and 4D listens to only one (1) of them, replace any with your ip address.

Fire it up (hit return in the terminal), enter the administrators password and if you don’t get an error message, it is done.

Now test it in a browser.Enter the ip address 4D’s web server is listing to and hit enter. http://localhost should do it, too.

Let’s assume it does work. It does not work? Try http://localhost:8080 – this does? Try again with the IP address 4D’s web server is listening to.