4D v16.3

Web server configuration and connection management

Home

 
4D v16.3
Web server configuration and connection management

Web server configuration and connection management  


 

 

4D and 4D Server include a Web server (also called the HTTP server) that enables you to publish the data of your databases on the Web, transparently and dynamically.

This section describes the steps necessary for launching the Web server and for the connection of browsers, as well as the process of connection management.

To be able to launch the HTTP server of 4D or 4D Server, you must have the elements described below:

  • A "4D Web Application" license. For more information, please refer to your 4D installation guide.
  • Web connections are made over the network using the TCP/IP protocol. Consequently:
    • You must have TCP/IP installed on your machine and correctly configured. Refer to your computer or Operating System manuals for more information.
    • If you want to use SSL for network connections, make sure that requested components are correctly installed (see the Using TLS Protocol section).
  • After all the previous points have been checked and taken care of, you need to start the Web server from within 4D. This last point is discussed further on in this section.

By default, any 4D client machine can publish the database to which it is connected on the Web. However, you can control the possibility of Web publication for each remote 4D machine by using the 4D password system.

In fact, 4D Web licenses are considered as plug-in licenses by 4D Server. Therefore, in the same way as for plug-ins, you must retrict the right to use Web Server licenses to a specific group of users.

To do this, display the Groups page in the Toolbox using 4D (you must have suitable access authorization to modify these parameters).

Select a group in the list on the left, then check the Access option next to the 4D Client Web Server line in the Plug-in distribution area:

Above: only users belonging to the "4D Client Web Server" group are authorized to publish their 4D machine as a Web server.

Under Mac OS X, using TCP/IP ports reserved for Web publishing (ports 0 to 1023) requires specific access privileges. In order for you to be able to use these ports, 4D provides a utility program named HelperTool. When this program is installed, it retrieves the appropriate access rights and automatically takes charge of opening the Web ports. This mechanism functions with 4D (all modes), 4D Server and 4D Volume Desktop executable applications.

The HelperTool application is included in the 4D software. Installation takes place automatically during the first opening of a port <1024 on the machine. The user is informed that a tool is going to be installed and is prompted to enter a name and an administrator password for the machine. This operation only takes place once.
The application is renamed "com.4D.HelperTool" and is installed in the folder "/Library/PrivilegedHelperTools/." After the initial sequence, the 4D Web server can be started and stopped transparently, regardless of the 4D version used.

The 4D WebServer can be started in three different ways:

  • Using the Run menu of 4D or the HTTP Server page of 4D Server (Start HTTP server button). These commands allow you to start and stop the WebServer at your convenience:

4D:

4D Server:

  • Automatically starting it each time the 4D application is opened. To do this, display the Configuration page of the Web theme of the Database Settings:

In the “Publishing Information” section, select the Launch Web Server at Startup check box, then click OK. Once this is done, the database will be automatically published on the Web each time you open it with 4D or 4D Server.

Tip: You do not need to quit 4D and reopen your database to start or stop publishing a database on the Web. You can interrupt and restart the Web server as many times as you want, using the Run menu, the Start HTTP server button or by calling the WEB START SERVER and WEB STOP SERVER commands.

The Test Web Server command can be used to make sure the built-in Web server is functioning correctly (4D only). This command is accessible in the Run menu when the Web server is launched:



When you select this command, the home page of the Web site published by the 4D application is displayed in a window of your default Web browser:

This command lets you verify that the Web server, home page display, etc. work correctly. The page is called using the URL Localhost, which is the standard shortcut designating the IP address of the machine on which the Web browser is executed. The command takes into account the TCP publication port number specified in the database settings.

After you have started publishing a 4D database on the Web, you can connect to it using a Web browser. To do so:

  • If your Web site has a registered name (i.e., “ www.flowersforever.com”), indicate that name in the Open, Address, or Location area of your browser. Then press Enter to connect.
  • If your Web Site does not have a registered name, indicate the IP address of your machine
    (i.e., 123.4.567.89) in the Open, Address, or Location area of your browser. Then press Enter.

At this time, your browser should display the home page of your Web site. If you have published a database in keeping with standard configurations, you should obtain the default home page of the 4D Web server. This page lets you test the connection and the server operation.

You may also encounter one of the following situations:

1. The connection fails and you get a message such as “...the server may not be accepting connections or may be busy...”.
In this case, check the following:

  • Verify that the name or the IP address you entered is correct.
  • Verify that 4D or 4D Server is up and running and has started its Web server.
  • Check if the database is configured for being served on a TCP Port other than the default Web TCP Port (see situation 3).
  • Check whether TCP/IP is correctly configured on both the server and browser machines. Both machines must be on the same net and subnet, or your routers must be correctly configured.
  • Check your hardware connections.
  • If you are not locally testing your own site, but rather attempting to connect to a Web database served on Internet or Intranet by someone else, ultimately, the message might be true: the server may be off or busy. So, retry later until you can log on, or contact the Web provider.

2. You connect, but you get an HTTP 404 "File not found" error. This means that the site home page has not be served. In this case, check that the home page actually exists at the location defined in the database settings (see the Web Server Settings section) or using the WEB SET HOME PAGE command.

3. You connect, but you do NOT obtain the Web page you were expecting! This can occur when you have several Web servers running simultaneously on the same machine. Examples:

  • You are running only one 4D Web database on a Windows system that is already running its own Web server.
  • You are running several 4D Web databases on the same machine.

In this kind of situation, you need to change the TCP port number on which your 4D Web database is published. To do so, refer to the Web Server Settings section.

Note: If your database is protected by a password system, you may have to enter a valid user name and password (for more information, refer to the Connection Security section).

Each time a Web browser attempts to connect to the database, the request is handled as follows:

  • First, one or more temporary local 4D processes called Web Connection Processes are created in order to evaluate and manage the connection with the Web browser.
    These temporary processes manage every HTTP request. They execute quickly and are then aborted or delayed. In order to optimize the Web server, once a request has been handled, 4D freezes this “pool” of Web processes for a few seconds so that it can reuse them if necessary when another request arrives. You can customize this behavior (timeout, minimum and maximum number of processes to be kept in the "pool") using the SET DATABASE PARAMETER command.
  • The Web process handles the processing of the request and sends a response (if necessary) to the browser. The temporary process is then aborted or delayed (see above).



See also 

_o_SET WEB DISPLAY LIMITS
_o_SET WEB TIMEOUT
Using TLS Protocol
WEB SEND FILE
WEB SET ROOT FOLDER
WEB STOP SERVER

 
PROPERTIES 

Product: 4D
Theme: Web Server

 
HISTORY 

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)