Resources

Module providing resource over HTTP

Introduction

Use the Resources module to publish static content ("resources") from the local filesystem using HTTP.

Multiple instances can be configured and deployed to publish content from different directories.

This module is also used internally by other modules (like AuthN) to provide support for static content.

Configuration

Module name: Resources

The Resources module deploys a Resource module for each configured resource.

The Resource module is a HttpModule and supports all common http configuration properties. Configuration properties for context (http_context) and CORS (http_cors) available on module level are passed on to each resource.

Name
Description

http_context

Web context path of module. All resources will share this context (mandatory).

http_cors

CORS configuration for all resources (optional).

resources

Array of resource configuration objects.

resources[*].context_path

Relative context path of resource. This value will be combined with module context to form the actual context.

resources[*].webroot_dir

Directory from where files are served. All files in this directory and subdirectories are available (if readable).

resources[*].overlay_dir

Web root overlay directory. (optional; if not configured overlay is disabled)

resources[*].public

Flag controlling if resources provided by this module are public or requires an authenticated session.

resources[*].enable_precompression

Flag to enable/disable support for pre-compressed resources. (default: false)

resources[*].enable_precompression_overlay

Flag to enable/disable support for pre-compressed overlay resources (default: false)

Pre-compressed resources

Pre-compression means that a resource/file compressed in advanced and available in webroot/overlay is served instead of the version requested by the user-agent. From the user-agents perspective this works just like regular (inline) compression but it saves up resources on the server

Pre-compression is activated when the user-agent tells the server it supports it by sending the appropriate request header.

// Example requets header specifying support for gzip compression
Accept-Encoding: gzip

This header contain one or more encoding types that is supported by the user-agent.

If a compressed file exist, with the correct extension (see below), this file will be returned with the appropriate response header.

// Response header specifying that content is compressed usign gzip
Content-Encoding: gzip

The following encodings (compressions) are supported:

Encoding type
File extension
Description

br

.br

Brotli

gzip

.gz

Gzip

To disable pre-compression the user-agent can send the following request header:

X-Precompressed-Content: false

When a response contains pre-compressed content the following response headers are returned (for debugging):

X-Precompressed-Content: true
X-Precompressed-Path: <request-path-to-precompressed-file>
X-Precompressed-Encoding: <precompress-encoding>