Entry path as Directory or Regular expression

Entry path as a directory

 
Info

The mapping behavior of trailing slashes depends on the chosen validator – see Option Enforce trailing slashes.

The following example illustrates request handling with a directory entry path.

Setup

Virtual host:

  • Name = example.com
  • Protocol = HTTPS

Mapping:

  • Entry path = /private/ (directory)
  • Back-end path = / (directory)

Back-end host:

  • IP = 198.51.100.1
  • Protocol = HTTP

Request handling (incoming request URL ➔ back-end request URL or redirect)

Forwarded requests:

  • -https://example.com/private/
    http://198.51.100.1/
  • -https://example.com/private/index.html
    http://198.51.100.1/index.html
  • -https://example.com/private/images/logo.gif
    http://198.51.100.1/images/logo.gif

Request without trailing slash:

https://example.com/private (no trailing slash)
the gateway sends a redirect to https://example.com/private/

The ignore-case icon next to the field determines whether the entry path is matched case-insensitively. When enabled, requests for /CRM and /crm are sent to the same mapping.

Entry Path as a regular expression

The entry path is interpreted as a regular expression. A request matches the entry path if its URL path matches the specified regular expression. The ignore-case icon behind the field determines if the match is case-sensitive. If the entry path is a regular expression, the back-end path must be a replacement pattern that transforms the entry path to the back-end path. It normally contains back-references ($1, $2...$9) that correspond to parts of the entry path (substrings in parentheses, see example below).

 
Info

Any URL parameters (after the ? in the URL) are not part of the entry path, these parameters will be ignored for the regular expression match. After constructing the back-end path, the parameters of the original request URL are appended to construct the complete back-end URL. It is not possible to append new parameters to the back-end URL.

 
Notice

The URL path of a request may match multiple regular expressions. For that reason, a unique priority must be chosen for each regular expression mapping.

The following example illustrates request handling with a regular expression entry path.

Setup

Virtual host:

  • Name = example.com
  • Protocol = HTTPS

Mapping:

  • Entry path = ^/session_([0-9A-F]{8})/(.*\.(gif|jpg|ico))$ (regular expression)
  • Back-end path = /session_$1/img/$2 (replacement pattern)

Back-end host:

  • IP = 198.51.100.1
  • Protocol = HTTP

Request handling (incoming request URL ➔ back-end request URL)

  • -https://example.com/session_373E04C5/logo.jpg
    http://198.51.100.1/session_373E04C5/img/logo.jpg
  • -https://example.com/session_373E04C5/test/space.gif
    http://198.51.100.1/session_373E04C5/img/test/space.gif
 
Info

The rewriting variables %ENTRYDIR%, %ENTRYPATH%, %BACKENDDIR% and %BACKENDPATH% cannot be used because their value is undefined for a regular expression mapping.