Configuring Server Farm in Mode-2 (Url Redirect)

The first step is to construct a Mode-0 server farm. A Mode-2 server farm should also be able to work in Mode-0, so build and test your cluster following the instructions here: https://unigui.com/doc/online_help/setting-up-a-hyperserver-serve.htm

Once you have a working Mode-0 server farm you can proceed to modify your cluster to operate in Mode-2. You can mix ServerNodes with different modes (some ServerNodes can be Mode-0 while others run in Mode-2).

Open the configuration (CFG) file of your master HyperServer and locate the section where your ServerNode is configured, for example:

CFG example (server-0 section)
[server-0]

enabled=1

url=http://localhost/webapp/server-0/hyper.dll

name=ServerNode-0

token=favwe314324324175924563

global_url=

cluster_mode=2

avoid_direct_access=1

url_timeout_secs=300

error_redirect_master=0

Below parameters are meaningful only in cluster Mode-2. They have no effect in Mode-0.

global_url

This URL will be used to publicly access the related ServerNode. Assign this parameter only if the public URL of your ServerNode is different from the url parameter.

Normally, the master HyperServer uses the url parameter to send control commands and obtain status of the ServerNode. This URL can be the same URL which is used for public access.

For some reasons you may want to use a private URL for url and a public URL for global_url.

Important note: the url parameter must be a complete URL, not a translated, rewritten or redirected URL. For instance, if the complete URL to your ServerNode is: https://srv1.mydomain.com/myisapi/myapp.dll and you have simplified it to https://srv1.mydomain.com using URL rewriting, then the url parameter must be the complete URL to your ServerNode:

url=https://srv1.mydomain.com/myisapi/myapp.dll

For global_url you may use the simplified URL:

global_url=https://srv1.mydomain.com

Example:

If you use the same URL for both, assign only url and leave global_url empty.

cluster_mode

Set the cluster mode for this ServerNode. For Mode-2, set:

Default value is 0.

avoid_direct_access

Control direct access to ServerNodes. See the section Isolating ServerNodes in Mode-2: https://unigui.com/doc/online_help/isolating-servernodes-in-mode-.htm

Default value is 0. In production you will likely set it to 1 to prohibit direct access:

url_timeout_secs

This parameter works with avoid_direct_access. When avoid_direct_access is enabled, url_timeout_secs determines how long a generated URL remains active. Default is 300 seconds (5 minutes).

Example:

Note: It is required to restart the cluster after changing modes. At minimum restart the master HyperServer and any ServerNodes whose mode you changed.

error_redirect_master

When an expired URL is referenced, the server raises an exception and no session is created. Instead of showing an error, you can redirect the request to the master server by setting:

This option is effective only when avoid_direct_access is enabled. Default is 0 (disabled).

Note: This feature works only when the redirection URL is intact. A complete redirection URL looks like this (automatically generated by the master server):

http://app1.mydomain.com/webapp/server-0/hyper.dll?rdrprm=89957281F52B8BDB27B39DB51793D5DC&rfr=aHR0cDovL2xvY2FsaG9zdC93ZWJhcHAvaHlwZXIuZGxs

If the URL is modified or parameters are missing, an error will be raised and no redirection to the master will occur.

Important hint: When error_redirect_master is enabled, make sure system clocks of your servers are synchronized. If the master and a slave differ by more than url_timeout_secs, the master-generated URL may be seen as expired and rejected by the slave, possibly causing an indefinite redirection loop. In multi-server setups ensure time difference between master and any slave is not greater than url_timeout_secs, or increase url_timeout_secs appropriately.

Steps to convert a ServerNode to Mode-2

1

Prepare a Mode-0 cluster

Build and test your cluster in Mode-0 first (see: https://unigui.com/doc/online_help/setting-up-a-hyperserver-serve.htm).

2

Edit master HyperServer CFG

Open the master HyperServer CFG file and find the ServerNode section (see example above).

3

Set cluster_mode=2 and configure global_url, avoid_direct_access, url_timeout_secs, and error_redirect_master as needed. Restart master and changed ServerNodes.

clip0239
circle-info

SSL Note: If your ServerNodes use a secure URL (https://) you should copy the SSL DLLs into the HyperServer master folder. Those DLLs can be found under:

..\Framework\uniGUI\SSL\dll\x86

or

..\Framework\uniGUI\SSL\dll\x64