SREhttp/2 Manual || Edit HOSTDATA.CFG

Specifying Host-specific configuration files

Contents:

Introduction

SREhttp/2 extends SRE2003's support for multiple hosting through the use of host specific configuration files. Essentially, SREhttp/2 allows you to specify two levels of parameters:

  1. Default parameters
  2. Host-specific parameters
and two kinds of parameters
  1. General parameters
  2. Selector-specific parametesrs

where ...

  • Default parameters can be used when no host-specific parameter is specified.
  • Host-specific parameters are only used with requests to a specific host.
  • General parameters apply to all requests.
  • Selector-specific parameters apply to requests to specific URIs, or to sets of URIs (as defined by wildcards).
  • You can specify default values, and host-specific values, for both general and selector-specific parameters.

    Defining host specific parameters

    In order to specify a host-specific parameters, you need to:
    1. define a host:
      This is done by modifying SREhttp/2's HOSTDATA.CFG file (in the SRE2003\SREHTTP2\CFG directory).
    2. creating host-specific configuration files (which are referenced in the HOSTDATA.CFG file).

    Notes:
    • HOSTDATA.CFG is used instead of SRE2003's HOSTINFO.CFG file.
    • To add or view these host definitions, you can use the SREhttp/2 on-line configurator -- look for the Host Configurator link.
    • Hosts that are not defined in HOSTINFO.CFG are automatically assigned the DEFAULT host-nickname. Actually, only the canonical host and all hosts mentioned in the SRE2003's DEFAULT_HOSTS parameter, are assigned the DEFAULT host-nickname. Note that DEFAULT_HOSTS is specified in SRE2003.CFG.

    Step 1 is described in the next section. Basically, HOSTDATA.CFG is used to tell SREhttp/2 where to find host-specific configuration files, and when to use default parameters.

    Step 2 is described in ATTRIBS.HTM. Basically, host-specific versions of ATTRIBS.CFG (and a few other files) can be used to specify general and selector-specific parameters. These parameters control authentication requirements, redirection, file location, and a variety of other features.


    The HOSTDATA.CFG file

    HOSTDATA.CFG, in the SREHTTP2\CFG directory, contains data on where to find parameters associated with the various hosts defined by SRE2003.

    HOSTDATA.CFG is a text file that contains multi-line records, with each line having a mime-like structure.
    The basic structure of HOSTDATA.CFG is:

       NICK: host_nickname
       HOST: domain_name or Ip_address (one or several)
       DATADIR: default_data_directory (for web accessible files)
       CFG: host_dir
       SUPERCEDING:   a_value
             
       NICK: host_nickname_2
       HOST: domain_name ...
            ....
    
    
    Thus, each record in HOSTDATA.CFG ends with a blank line (or with the end of file).

    NICK: Required. A case insensitive host-nickname (which can not contain embedded spaces). host_nicknames are used throughout SREhttp/2 (and SRE2003) to define host specific parameters.
    HOST: Required. Either one, or several, domain name(s) (such as foo.bar.net) or IP address(es) (such as 192.155.3.2). If specifying several, seperate each domain name (or IP address) with one or more spaces.
    In general, SREhttp/2 will use the Host: header (sent by all modern browsers) to specify which host the client's request is directed to. The value of this Host: header will be compared to the various HOST: entries in HOSTDATA.CFG.

    If you define several domain names (or IP addresses) with a HOST:, then you are basically declaring that these different domain names (or IP addresses) are merely synonyms for a single site -- the site that is specified by the host nickname.

    DATADIR: Required. The default data directory for this host. Unless otherwise specified (say, through a selector-specific attribute). all requests to this host are assumed to refer to files that are relative to this host specfic data directory.
    CFG: Optional. host_dir should be a relative, or an absolute, directory. If a relative directory, it should be relative to the SREHTTP2\CFG directory.

    If not specified, then there will be no host-specific parameters (for this host_nickname).

    If specified, then this host_dir directory can contain the following files:

  • SREHTTP2.CFG -- host-specific "general" parameters
  • ATTRIBS.CFG -- host-specific "selector-specific" parameters
  • SSI_VARS.CFG -- host-specific Server Side Include variables
  • MIMETYPE.CFG -- host specific "extension to mimetype" mappings
  • USERS.CFG -- host specific "username/password" entries
  • All these files are optional -- if a file is not defined, then there will be no host-specific values for the types of parameters defined in the file.

    Note: the "defaults" for these five files are in the SREHTTP2\CFG directory.

    SUPERCEDING: Optional. a_value should be either:
  • 0 = Not superceding (the default, if SUPERCEDING is not specified)
  • 1 = Superceding
  • 2 = Strictly superceding
  • Superceding is used to control when the values of the default ATTRIBS parameters are used. For each value, the order of precedence are (with higher rules used whenever possible).
    • Not superceding
      1. Exactly matching host-specfic parameter
      2. Exactly matching default parameters
      3. "Wildcarded" host-specific and wildcarded default parameters are pooled, and the "best" match is used.
    • Superceding
      1. Exactly matching host-specfic parameter
      2. Wildcarded host-specific parameters
      3. Exactly matching default parameters
      4. "Wildcarded" default parameters
    • Strictly superceding
      1. Exactly matching host-specfic parameter
      2. Wildcarded host-specific parameters
    Thus, requests to "strictly superceding" hosts never use default ATTRIBS parameters, while requests to "superceding" hosts use default ATTRIBS parameters only if there is no host-specific parameters. Non-superceding hosts favor host-specific parameters, but only if the match is exact.

    Reminder: default ATTRIBS parameters are defined in the ATTRIBS.CFG file typically located in SREHTTP2\CFG


    The Default Host

    There is one special entry in HOSTDATA.CFG: the default host. The default host is typically specified in a one line record, consisting of just a

       Host: Default


    Example

    The following is an example of a HOSTDATA.CFG file
       Host: Default
    
       Nick: MAIN
       Host: 82.55.25.12  Mine.Oursite.net   
       CFG:  MY_CFGS
       Datadir: f:\www\d1
    
       Nick: HISHER_SITE
       Host: His.Oursite.net
       Datadir: f:\www\d2
       CFG:  E:\DATA\HFGS
       Superceding: 1
    
       Nick: HISHER_SITE
       Host: Her.Oursite.net
       Datadir: f:\www\d2
       CFG:  E:\DATA\HFGS
       Superceding: 1
    
    
    Note that one could combine the His.Oursite.net and Her.Oursite.net entries into one entry
    (by using Host: His.Oursite.net Her.Oursite.net).
    Updated 27 June 2002