Local Content

IBM Application Gateway (IAG) can serve content from the inbuilt local web server document root. Requests made directly to IAG which do not match any resource servers will be served content from this local document root.

1256

By default, the IAG local document root includes a splash screen 'index.html' and an icon 'favicon.ico'. A copy of the default document root can be retrieved from the pages directory of the IAG Resources repository.

PagesDescription
local_pages.zipThis zip file contains a directory structure including the default local pages content.

Replacing the default Document Root

The default document root can be replaced by providing content to IAG in two different ways. The content can either be provided as a zip archive or a directory which is bind mounted into the IAG container.

For example, to replace the document root with the content of an archive 'staticContent.zip' which is mounted in the container at '/var/iag/config/staticContent.zip':

server:
  local_pages:
    content: "@staticContent.zip"
    type:    zip

For example, to replace the document root with the content of the directory 'staticContent' which is mounted in the container at '/var/iag/config/staticContent':

server:
  local_pages:
    content: staticContent
    type:    path

See also: YAML Reference for local_pages

📘

Note

Note that when any content is provided, IAG first removes all of the default content from the document root before populating it with the provided content.

When Local Content is Served

Requests which do not match any resource server and will be processed by the local web server are:

  1. Requests that do not contain a host header that matches any 'virtual_host' type resource servers
  2. Requests with a URL that does not match any 'path' type resource servers

Using Directories within Local Content

The directory structure of the provided content may contain subdirectories. Be aware that IAG will first attempt to match the request to a resource server before falling back to the local web server.

For example, consider the following provided content and IAG configuration
YAML:

Provided Content localContent.zip

index.html
images/logo.jpg
assets/style.css

IAG Configuration

version: "23.04"
server:
  local_pages:
    content: localContent.zip
    type: zip
resource_servers:
  - path: /assets
    servers:
      - host: 10.10.10.200
        port: 2308

A request which attempts to retrieve the local content '/assets/style.css' will not be possible as IAG will process the request using the resource server '/assets' rather than the local web server.

🚧

Note

Note that if a path type resource server is created with the path / the local web server document root will not be accessible.

How Local Content is Stored

Regardless of how the content is provided, IAG will copy the provided content to a directory inside of the container during bootstrapping. Be aware that if a large amount of content or large files are included, these will contribute to the container size and startup time.