Skip to main content
Version: 0.9.1

Static Files

An ingress configuration file may define zero or more static file policies. Static file policies serve files directly from the local filesystem without proxying to an upstream.

static_files = [
{
routes = [
{
# Match requests for these hostnames.
hosts = ["example.com"]

# Match requests with this path prefix.
path = "/assets"

# Absolute path to the directory on disk.
file_dir = "/var/www/html"

# Filename to serve when a directory is requested.
index = "index.html"

# Whether to show directory listings.
directory_listing = false

# Maximum file size in bytes (10 MiB).
max_file_size = 10485760

# See: Compression, Cache Policy
compression = { ... }
cache_policy = { ... }
}
]
}
]

Fields

FieldTypeDefaultDescription
hostslist(string)(required)The list of hostnames this static route applies to. Requests are only matched if the Host header matches one of the specified values. Use ["*"] to match all hostnames.
pathstring(required)The URL path prefix to match.
file_dirstring(required)Absolute path to the directory on disk that will be served. Must exist, must be a directory, and must not be /.
indexstring(optional)Filename to serve when a directory is requested.
directory_listingbooleanfalseWhether to enable directory listings when no index file is present.
max_file_sizeinteger10485760Maximum file size in bytes. Defaults to 10 MiB.
compressionobject(optional)Compression settings. See Compression.
cache_policyobject(optional)Cache-Control header configuration. See Cache Policy.