Skip to content
Beta

Static web delivery with optional CDN

Last updated on

This pattern targets internet-facing static delivery on STACKIT. It is independent of Cloud Foundry and uses Object Storage plus CDN for static content delivery.

  • High static content share: front-end assets dominate traffic volume.
  • Global or distributed user base: lower latency is needed for static content delivery.
  • Controlled origin architecture: object storage remains in STACKIT while CDN delivery is optimized.
UsersCDN (optional)Object StorageObservability HTTP/HTTPSoptional direct pathstatic asset deliveryoptional origin metricsoptional CDN metrics
  • Use CDN only where it adds measurable value: keep CDN optional and validate impact with latency and cache-hit metrics.
  • Define cache invalidation behavior early: include cache invalidation and versioning strategy in the release process.
  • Keep API and static delivery boundaries clear: avoid mixing cache-sensitive API responses with static content policies.
  • Monitor origin fallback rates: high fallback can indicate cache policy or asset versioning problems.

Choose the origin backend and cache behavior before switching static-content traffic. Validate private bucket access, cache headers, and the release purge procedure with representative assets; the product capabilities below do not replace cutover acceptance tests.

From the STACKIT docsCDN features and options › Source (origins and backends)Source updated 16.11.2026 · copied 06.10.2026

The origin is the definitive source of your content. The STACKIT CDN fetches resources from the origin when they are not in the edge cache or when edge delivery rules exclude them.

There are two backend types available:

  • HTTP backend: Connects to any publicly accessible web server via a URL or IP.
  • Bucket backend: Specifically designed for S3-compatible storage. It allows the CDN to use stored credentials (access key ID and secret key) to fetch private assets securely.
What is this?

This section is copied from the STACKIT docs automatically, several times a day. It cannot be changed here. Changes belong in the STACKIT docs.

From the STACKIT docsCDN features and options › CacheSource updated 16.11.2026 · copied 16.11.2026

The STACKIT CDN accelerates content delivery by storing copies of your assets in edge locations across your selected regions (EU, US, AF, SA, ASIA). This reduces latency and minimizes the load on your origin server.

Default cache duration (TTL)

The time to live (TTL) determines how long an asset remains in the CDN cache before it is considered stale and must be fetched again from your origin.

  • Origin headers: By default, the CDN respects cache-control headers sent by your origin server.
  • Custom default TTL: If your origin does not provide a cache-control header, the CDN applies the default cache duration defined in your distribution configuration.

Cache key configuration

The cache key is the unique identifier the CDN uses to determine whether an incoming request matches a cached asset.

By default, the CDN builds the cache key using only the request URL path. Query strings and request headers are ignored, meaning requests like /styles.css and /styles.css?v=2 serve the same cached file.

You can customize how the cache key is constructed using query parameters and HTTP request headers:

  • Include all query strings (queryStringVaryEnabled): When enabled, every unique combination of query parameters creates a separate cache entry (for example, /product?id=1 and /product?id=2 are cached separately).
  • Allowlist specific query parameters (queryStringVaryParameters): Restrict caching to specific query parameters. The CDN ignores any parameters not on this list. This lets you cache variations for functional parameters (such as page or product_id) while ignoring tracking parameters (such as utm_source).
  • Vary by request headers (cacheKeyHeaders): Specify HTTP request headers whose values should create separate cache entries (for example, using Accept-Language to cache localized versions of a page).

Including headers or arbitrary query strings creates more cache entries for the same path. This can significantly reduce your cache hit ratio and increase traffic to your origin.

When the Image Optimizer is enabled, the CDN automatically manages cache keys for optimized images based on requested dimensions and supported formats.

Purge

When you update content at your origin, the CDN may still serve the older version until the TTL expires. To force the CDN to fetch the latest version immediately, you must perform a manual purge.

There are different purge strategies available:

  • Full purge: Invalidates the entire cache for the distribution. While effective, a full purge for a large website can cause a “cache stampede,” where a massive volume of simultaneous requests hits your origin server to repopulate the cache.
  • Granular (Path-based) Purge: Invalidates only a specific path (e.g., /static/styles.css). This is the recommended approach for most updates, as it maintains the cache for unaffected assets and reduces the load on your origin.

To optimize your caching strategy, use the logging tools of STACKIT CDN to identify which assets are served from cache versus those causing origin pressure.

What is this?

This section is copied from the STACKIT docs automatically, several times a day. It cannot be changed here. Changes belong in the STACKIT docs.

Repository:

Code & registry github.com STACKIT CMF Replatform Static Webserver repository Open the repository

The repository is structured analog to the existing CMF Terraform samples and uses the common feature flags:

  • setup_project
  • setup_observability
  • setup_database
  • setup_workload
  • setup_loadgen
  • setup_dns
  1. Copy the example file: cp env.tfvars.example env.tfvars
  2. Set required project and static delivery values:
project_id = null
parent_container_id = "cmf-parent-container-id"
project_name = "cmf-static-webserver"
service_account_key_path = "/path/to/stackit-sa-key.json"
objectstorage_bucket_name = null
cdn_regions = ["EU", "US"]
  1. Set feature switches:
setup_project = true
setup_observability = true
setup_database = false
setup_workload = true
setup_loadgen = false
setup_dns = false
  1. Apply:
Terminal window
terraform init
terraform apply -var-file=env.tfvars

Expected result: static_web_url returns the static content endpoint (.../index.html) over CDN.

Note: This pattern intentionally does not provision VM or load balancer components.

Asset historyActive 1 of the last 12 weeksLWUpdatedNo updates · 1 bar = 1 week i
Maintainer
LWLukas WeberrußHead of STACKIT Cloud Migration Framework · STACKITOwnerActive 12 of the last 12 weeks · 58 updatesSTACKITwww.linkedin.com/in/lukas-weberruß-a360b081TMTobias M.Head of STACKIT Cloud Framework · STACKITOwnerActive 11 of the last 12 weeks · 196 updatesSTACKITwww.linkedin.com/in/tobias-müller-011304172Contributed in STACKIT
Show full history (3 more)