SERVICE section

Configures the internal server to handle HTTP requests based on the request’s URI and EXT.

Configuration Items

The following is the configuration format of the SERVICE section.

"service": {
    "uri": [
        {
            "name": string,
            #"target_http_servers": [string],       # ["*"]
            "match": {
                #"rewrite": string,
                #"type": string,                    # "prefix"
                "target": string,
                #"redirect": string,
                #"redirect_status": integer,        # 302
                #"enable_cache": boolean            # false
            },
            "destination": {
                "type": string,
                "target": string
            },
            #"access": string
        }
    ]
    "ext": [
        {
            "name": string,
            #"target_http_servers": [string],       # ["*"]
            "match": {
                #"type": string,                    # "exact"
                "target": string,
                #"enable_cache": boolean            # false
            },
            "destination": {
                "type": string,
                "target": string
            },
            #"access": string
        }
    ]
}

Refer to Types of Setting Values and Configuration Methods for more information on symbols and details of the SERVICE section configuration items.

uri

The URI section is used to provide different destinations to process requests according to the Uniform Resource Identifier (URI) value of the client request.

For example, if the address http://www.tmax.co.kr/JSV/test is requested, the "/JSV/" URI can be set to jeus.

Item Description

Data Type

Array (object)

In the following example, the URI section must be configured for <first> or a URI that starts with <first> must be used.

http://<hostname>:<port>/<first>/<second>/index.html

uri/name (Required)

Sets the name of the URI section.

Item Description

Data Type

String

Range

Up to 31 characters

uri/target_http_servers

Specifies the server name to process the request. (Example: "target_http_servers": "http1")

If a specific vhost is to handle the request, configure it as '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

["*"]

The following describes each configuration value.

Value Description

"*"

Applies to all servers.

uri/match (Required)

Sets a rule to handle a request if its URI matches a specific pattern.

Item Description

Data Type

Object

uri/match/rewrite

Sets the value to change for uri/match/target.

Item Description

Data Type

String

Range

Up to 255 characters

uri/match/type

Specifies the type of pattern configured for the URI. The matching method used for HTTP Request path varies depending on the pattern type.

Item Description

Data Type

String

Range

"prefix"

Default Value

"prefix"

The following describes each configuration value.

Value Description

prefix

The pattern set in uri/match/target is the prefix of the HTTP request URL.
(For example, the pattern "/uri/" matches request paths such as "/uri/a/", "/uri/a/b/", "/uri/a/b/c", etc.)

uri/match/target (Required)

Specifies the pattern that matches the HTTP request path. Once matched, the URI section configuration is applied to the request.

Item Description

Data Type

String

Range

Up to 255 characters

uri/match/redirect

Maps a request for the specified URI to another URI.

Depending on the value of redirect_status set in the URI section, the value set in redirect is set in the Location header field of the HTTP response and delivered to the user. If the value of redirect_status is omitted, the default value of "302 Found" is used.

Item Description

Data Type

String

Range

Up to 255 characters

uri/match/redirect_status

Specifies the HTTP status code to be used when using redirection.

Item Description

Data Type

Integer

Range

301 | 302 | 303 | 305 | 407 | 410

Default Value

302

The following describes each configuration value.

Value Alias Description

301

permanent

Responds with "301 Moved Permanently".

302

found

Responds with "302 Found".

303

seeother

Responds with "303 See Other".

305

useproxy

Responds with "305 Use Proxy".

307

temp

Responds with "307 Temporary Redirect".

410

gone

Responds with "410 Gone".

uri/match/enable_cache

Sets whether the content is cached.

Item Description

Data Type

Boolean

Default Value

False

uri/destination (Required)

Sets the destination of the URI service.

Item Description

Data Type

Object

uri/destination/type (Required)

Sets the type of the destination.

Item Description

Data Type

String

Range

"HTMLS" | "JEUS" | "REVERSE_PROXY"

uri/destination/target (Required)

Sets the target of the destination. It must match the name specified in the DESTINATION section.

Item Description

Data Type

String

Range

Up to 127 characters

uri/match/access

Sets whether to allow requests from a specific IP. The setting value must match the name set in access/access_list/name.

Item Description

Data Type

String

Range

Up to 255 characters

ext

Maps a client request to a specific process based on the requested file extension.

Item Description

Data Type

Array (object)

WebtoB is already configured with mappings between basic MIME types and processes. However, if additional settings are needed, they can be modified in the relevant section.

ext/name (Required)

Sets the name of the EXT section.

Item Description

Data Type

String

Range

Up to 31 characters

ext/target_http_servers

Specifies the server name to process the request. (Example: "target_http_servers": "http1")

If a specific vhost is to handle the request, configure it as '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

["*"]

The following describes each configuration value.

Value Description

"*"

Applies to all servers.

ext/match (Required)

Sets a rule to process a file if its extension matches a specific pattern.

Item Description

Data Type

Object

ext/match/type

Sets the type of pattern configured in ext/match/target. The matching method used for HTTP Request path varies depending on the pattern type.

Item Description

Data Type

String

Range

"exact"

Default Value

"exact"

The following describes each configuration value.

Value Description

exact

Matches if the set pattern matches the extension.
(Example: The pattern "abc" matches only if the extension is "abc". No other extensions will match.)

ext/match/target (Required)

Specifies the pattern that matches the HTTP request path. Once matched, the EXT section configuration is applied to the request.

Item Description

Data Type

String

Range

Up to 127 items

ext/match/enable_cache

Sets whether the content is cached.

Item Description

Data Type

Boolean

Default Value

False

ext/destination (Required)

Sets the destination for the Extension service.

Item Description

Data Type

String

ext/destination/type (Required)

Sets the type of the destination.

Item Description

Data Type

String

Range

"HTMLS" | "JEUS" | "REVERSE_PROXY"

ext/destination/target (Required)

Sets the target of the destination. It must match the name specified in the DESTINATION section.

Item Description

Data Type

String

Range

Up to 127 characters

ext/match/access

Sets whether to allow requests from a specific IP. The setting value must match the name set in access/access_list/name.

Item Description

Data Type

String

Range

Up to 255 characters

Example

The following is an example of configuring the SERVICE section.

"service": {
    "uri": [
        {
            "name": "static_uri",
            "target_http_servers": [
                "*"
            ],
            "match": {
                "type": "prefix",
                "target": "/static",
                "rewrite": "/"
            },
            "destination": {
                "type": "HTMLS",
                "target": "htmls1"
            }
        }
    ],
    "ext": [
        {
            "name": "ext1",
            "target_http_servers": [
                "http1.vhost1"
            ],
            "match": {
                "type": "exact",
                "target": "text/html"
            },
            "destination": {
                "type": "HTMLS",
                "target": "html1"
            }
        }
    ]
}