DIRECTORY Section

The DIRECTORY section configures the properties of a specific directory.

It includes options such as access for restricting directory access, as well as force_mime_type and default_mime_type for setting file extensions within the directory.

Configuration Items

The following is the configuration format of the DIRECTORY section.

#"directory": {
    "directory_list": [
        {
            "name": string,
            "path": {
                "target": string,
                #"type": [string],                  # "prefix"
            },
            #"target_http_servers": [string],       # ["*"]
            #"access": [string],
            #"error_document": [string],
            #"force_mime_type": [string],
            #"default_mime_type": [string]
        }
    ]
}

Refer to Setting Value Formats and Configuration for more information on symbols and details of the DIRECTORY section configuration items.

directory_list

A list of DIRECTORY settings.

Item Description

Data Type

Array (object)

directory_list/name (Required)

Sets the name of the DIRECTORY section.

Item Description

Data Type

String

Range

Up to 255 characters

directory_list/path (Required)

Sets the pathname of the directory to which the settings will be applied. The path can be an absolute path or a path relative to $WEBTOB_HOME.

Item Description

Data Type

Object

directory_list/path/target (Required)

Sets the pattern to match the directory pathname. If a match is found, the settings in the DIRECTORY section are applied to the request.

Item Description

Data Type

String

Range

Up to 255 characters

directory_list/path/type

Specifies the pattern type configured in the DIRECTORY section. The method used to match directory paths varies depending on the pattern type.

Item Description

Data Type

String

Range

"prefix", "exact", "regex"

Default Value

"prefix"

The following describes each configuration value.

Value Description

prefix

Matches when the pattern set in directory/directory_list/path/target is a prefix of the directory path.
(Example: The pattern "/directory/" matches paths such as "/directory/a/", "/directory/a/b/", and "/directory/a/b/c".)

exact

Matches when the pattern set in directory/directory_list/path/target is exactly identical to the directory path.
(Example: The pattern "/directory/" matches only when the directory path is "/directory/". It does not match any other directory paths.)

regex

Matches when the directory path satisfies the regular expression pattern configured in directory/directory_list/path/target.
(Example: The pattern "/directory.*" matches directory paths such as "/directory", "/directory/", and "/directory1".)

directory_list/target_http_servers

Specifies the server name when the directory settings will apply only to a specific server. (Example: "target_http_servers": "http1")

If the settings apply only to a specific vhost, set it to "server name.vhost name". (Example: "target_http_servers": "http1.vhost1")

Item Description

Data Type

Array (string)

Range

Up to 64 items (within 31 characters)

Default Value

["*"]

directory_list/access

Sets whether to allow a request based on its method, required headers, and the IP address it was sent from. The setting value must match the specified name set in access/access_list/name.

Item Description

Data Type

String

Range

Up to 255 characters

directory_list/error_document

Sets the name defined in the ERRORDOCUMENT section to replace the HTTP error page. This setting takes precedence over the error_document setting in the SERVER section.

Item Description

Data Type

Array (string)

Range

Up to 64 items (within 255 characters)

directory_list/force_mime_type

All resources within the specified directory are processed using the MIME-Type configured in force_mime_type.

Item Description

Data Type

String

Range

Up to 127 characters

directory_list/default_mime_type

Specifies the default Content-Type for documents whose MIME-Type cannot be determined. This setting takes precedence over the default_mime_type setting in the SERVER section.

Item Description

Data Type

String

Range

Up to 127 characters

Since the ext setting has a higher priority than the mime_type setting, ext must be removed to apply the mime_type settings.

Example

The following is an example of configuring the DIRECTORY section:

{
    "directory": {
        "directory_list": [
            {
                "name": "directory1",
                "path": {
                    "type": "prefix",
                    "target": "http/"
                },
                "access": "access1",
                "error_document": ["errorDoc1"],
                "force_mime_type": "text/html",
                "default_mime_type": "text/html"
            }
        ]
    }
}