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
                #"ext": [string],                   # []
                #"goto_ext": boolean,               # false
                #"stop_if_no_ext": boolean          # true
            },
            "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 Setting Value Formats and Configuration 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

This cannot be set if /uri/match/type is regex.

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", "exact", "regex"

Default Value

"prefix"

The following describes each configuration value.

Value Description

prefix

Matches if the pattern set in uri/match/target is the prefix of the HTTP request URL.
(Example: The pattern "/uri/" matches request paths such as "/uri/a/", "/uri/a/b/", and "/uri/a/b/c".)

exact

Matches if the pattern set in uri/match/target is the same as the HTTP request URL.
(Example: The pattern "/uri/" matches only when the request path is "/uri/". No other request paths will match.)

regex

Matches if the HTTP request URL satisfies the regular expression pattern set in uri/match/target.
(Example: The pattern "/uri.*" matches request paths such as "/uri", "/uri/", and "/uri1".)

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/match/ext

Specifies additional extensions for URI matching. This is used when applying a URI section only to specific extensions under a particular path.

Item Description

Data Type

Array (string)

Default Value

[]

uri/match/goto_ext

Sets whether to perform EXT matching after URI matching.

When an EXT match occurs, the corresponding EXT service takes precedence, and the previously matched URI settings will not be applied.

Item Description

Data Type

Boolean

Default Value

False

uri/match/stop_if_no_ext

When the goto_ext setting is enabled and no matching EXT is found, the matching stops, and the system determines whether to apply the current URI service or continue searching for the next URI service.

Item Description

Data Type

Boolean

Default Value

True

The following describes each configuration value.

Value Description

true

If no matching EXT found, matching stops and the current URI configuration is used.

false

If no matching EXT found, the system continues searching for the next URI configuration .

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" | "FCGI"

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 a request based on its method, whether specific headers are included, and the source IP address. 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

"prefix", "exact", "regex"

Default Value

"exact"

The following describes each configuration value.

Value Description

prefix

Matches if the pattern set in ext/match/target is the prefix of the extension.
(Example: The pattern "abc" matches extensions such as "abc", "abc1", and "abc12".)

exact

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

regex

Matches if the extension satisfies the regular expression pattern set in ext/match/target.
(Example: The pattern "jsp[a-z]" matches extensions such as "jspa", "jspb", and "jspx".)

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" | "FCGI"

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 a request based on its method, whether specific headers are included, and the source IP address. The setting value must match the name set in access/access_list/name.

Item Description

Data Type

String

Range

Up to 255 characters

Default Behavior

If a request does not match any settings in the SERVICE section, WebtoB routes the request to the default HTMLS named "#default_htmls".

For more information about "#default_htmls", refer to DESTINATION Section - Default Settings.

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"
            }
        }
    ]
}