KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4D Web serving on MacOS X 10.5 and port 80
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac OS X
Published On: January 31, 2008

With Apple's latest operating system, MacOS X 10.5 (Leopard), it is not possible to run the 4D Web Server on ports less than 1024 automatically.

So how do you accomplish Web serving with 4D?

Run the 4D Web Server on a port above 1024 (e.g. 8080) and use port forwarding to get traffic from port 80 to your Web server port.

Apple's MacOS X 10.5 (Leopard) operating system uses IPFW for firewalling purposes. With IPFW it is possible to write rules to re-direct traffic from one port to another.

The structure of an IPFW command for this is:

<command> <rule#> <action><proto> from <source> to <destination> in

In this case the rule breaks down as follows:

Parameter Value Comment
command add We are adding a new rule.
rule# anything between 1 and 65535 Order matters, if you have more than one rule.
action fwd <ip address>,<port> Forward to this address.
proto tcp Only forward TCP traffic.
source any This is the "client"...in this case anyone.
destination <public ip address> <port> This is the address the client would be trying to connect to.


The following rule would re-direct all incoming traffic from any computer on port 80 to port 8080

ipfw add 1000 fwd 127.0.0.1,8080 tcp from any to any 80 in

This would be a silly rule because *any* Web traffic (no matter the address of the Web server) would be redirected. This next example is more specific:

ipfw add 1000 fwd 127.0.0.1,8080 tcp from any to 123.456.789.10 80 in

This rule says, "for any incoming TCP request to 123.456.789.19:80, forward it to 127.0.0.1:8080". In this case the 4D Web server should be publishing on port 8080.

Information on IPFW can be found at:
http://en.wikipedia.org/wiki/Ipfirewall

Information on Apple's application firewall implementation can be found at:
http://docs.info.apple.com/article.html?artnum=306938

See Also:
Commented by Timothy Penner on June 26, 2009 at 10:22 AM
If you are using Mac OS X Tiger you can use the procedure discussed in Tech Tip 34120 instead: http://kb.4d.com/search/assetid=34120