4D v13.4

Web server configuration and connection management

Home

 
4D v13.4
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 section Using SSL Protocol).
  • 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 "Web" 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).

Various 4D processes support Web publication of databases and connection to browsers. This paragraph describes these processes as well as their characteristics.

The Web Server process runs and executes when the database is being published as a Web site.

In the Process page of the Runtime Explorer window shown here, the Web Server process is the fifth process that is running and executing:

This is a 4D kernel process; you cannot abort this process using the Abort button. Also, you cannot attempt interprocess communication using commands such as CALL PROCESS. Note that the Web Server process does not have any user interface components (windows, menus, and so on).

You can start the Web Server process in the following ways:

  • Click the Start HTTP server button on the "HTTP Server" page of 4D Server or choose Start Web Server in the Run menu of 4D.
  • Call the 4D command WEB START SERVER.
  • Open a database whose Launch Web Server at Startup setting is checked.

You can stop running the Web Server process in the following ways:

  • Click the Start HTTP server button on the "HTTP Server" page of 4D Server or choose Stop Web Server from the Run menu of 4D.
  • Call the 4D command WEB STOP SERVER .
  • Quit the database being currently published.

The purpose of the Web Server process is only to handle Web connection attempts. Starting the Web Server process does not mean that you open an actual Web connection, it just means that you allow Web users to initiate Web connections. Stopping the Web Server process does not mean that you close currently running Web connection processes (if any), it just means that you no longer allow Web users to initiate new Web connections.

If there are open Web connection processes when you stop the Web Server process, each of these processes continues executing normally.

Consequently, a delay time can be necessary to complete the termination of the Web Server process.

Each time a Web browser attempts to connect to the database, the request is handled by the Web Server process, which performs the following steps:

  • First, it creates one or several temporary local 4D processes called Web Processes to evaluate and manage the connection with the Web browser.
    These temporary processes manage every HTTP request. They execute quickly and then aborted or delayed. For the Web server to be reactive in non-contextual mode, 4D freezes this “pool” of Web processes for 5 seconds and reuses them to execute any possible future HTTP queries. You can customize this behavior using the command SET DATABASE PARAMETER.
  • 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).

 
PROPERTIES 

Product: 4D
Theme: Web Server

 
SEE ALSO 

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