Static web delivery with optional CDN
Last updated on
Overview
Section titled “Overview”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.
Typical use case
Section titled “Typical use case”- 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.
Architecture diagram
Section titled “Architecture diagram”Design best practices
Section titled “Design best practices”- 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.
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.
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.
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.
Automation repository
Section titled “Automation repository”Repository:
STACKIT CMF Replatform Static Webserver repository Open the repositoryThe repository is structured analog to the existing CMF Terraform samples and uses the common feature flags:
setup_projectsetup_observabilitysetup_databasesetup_workloadsetup_loadgensetup_dns
Repository usage and required settings
Section titled “Repository usage and required settings”- Copy the example file:
cp env.tfvars.example env.tfvars - Set required project and static delivery values:
project_id = nullparent_container_id = "cmf-parent-container-id"project_name = "cmf-static-webserver"service_account_key_path = "/path/to/stackit-sa-key.json"objectstorage_bucket_name = nullcdn_regions = ["EU", "US"]- Set feature switches:
setup_project = truesetup_observability = truesetup_database = falsesetup_workload = truesetup_loadgen = falsesetup_dns = false- Apply:
terraform initterraform apply -var-file=env.tfvarsExpected 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 4 of the last 12 weeksTMUpdatedNo updates · 1 bar = 1 week i
- LWLukas WeberrußHead of STACKIT Cloud Migration Framework · STACKITOwner
Lukas WeberrußHead of STACKIT Cloud Migration Framework · STACKITOwnerActive 10 of the last 12 weeks · 47 updateswww.linkedin.com/in/lukas-weberruß-a360b081