Skip to content

Fortified IDDocs

Resource

Configuration reference for publishing static files with the Resource module.

The Resource module publishes static files from a local directory over HTTP. Deploy multiple module instances when files must be served from different roots or HTTP contexts.

NameDescriptionDefaultMandatory
http_contextBase HTTP context for the published files."/resources"
context_pathRoute mounted below http_context."/"
webroot_dirLocal directory containing the files to publish.""
overlay_dirOne overlay directory or an ordered array of overlay directories. Overlay files take precedence over files in webroot_dir.[]
overlay_dirsCompatibility name for additional overlay directories. Prefer overlay_dir.[]
publicAllows requests without an authenticated session when enabled.false
http_auth_redirect_urlRedirect target for unauthenticated requests when public is false.""
enable_precompressionServes matching pre-compressed files from webroot_dir.false
enable_precompression_overlayServes matching pre-compressed files from overlay directories.false
cache_controlOrdered cache policies. See Cache control.Directory responses are not cached
use_cacheEnables the static handler cache.true
files_read_onlyEnables file metadata caching when files do not change while the service is running.true
cache_entry_timeout_msLifetime of cached file metadata in milliseconds.30000
max_age_secsBrowser cache lifetime for static files in seconds.86400

This example publishes files from htdocs/public at /assets/public. A matching file in htdocs/branding is served before the file in the web root.

When pre-compression is enabled and the request contains an Accept-Encoding header, the module looks for a matching compressed file before serving the original file.

Encoding File extension
Brotli .br
Gzip .gz

Send X-Precompressed-Content: false to disable pre-compressed content for an individual request. A pre-compressed response includes these diagnostic headers:

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

Without a cache_control object, directory and index responses receive Cache-Control: no-store, no-transform, max-age=0. Static files otherwise use the static handler cache settings.

Policies are evaluated in order and the first matching glob pattern wins:

{
"cache_control": {
"policies": [
{
"pattern": "**/*.html",
"value": "no-store, no-transform, max-age=0",
"override": true
},
{
"pattern": "**",
"value": "public, immutable, max-age=86400",
"override": true
}
]
}
}

Set override to false when the policy should only add the header if no earlier handler has already set it.