CDN origins and caching
The origin is the source of your content. When a visitor requests a file, the CDN fetches it from the origin, caches it at the edge, and serves the cached copy to later requests.
Origin types
Origin URL. Use when your content is on a server outside UpCloud, or to point at a specific URL. Configured with any public URL, including http:// or https://.
Object Storage. Use when your content is in one or more UpCloud Managed Object Storage buckets. The instance is picked from a list and the origin URL is set to the instance endpoint. See Object Storage origins below.
Load Balancer. Use when your content is behind an UpCloud Managed Load Balancer. The load balancer is picked from a list and the origin URL is set to its hostname.
Server. Use when your content is served directly by an UpCloud Cloud Server. The server is picked from a list and the origin URL is set to its public IPv4 address over http://.
The origin type and URL can be changed after creation from the Origin type section of the Overview tab. Changing the origin does not clear content already cached at the edge, so purge the cache afterwards.
Object Storage origins
With the Object Storage origin type, the origin is the instance endpoint rather than a bucket. The CDN passes the request path straight through, so the bucket name is the first segment of every CDN URL:
| CDN request | Fetched from origin |
|---|---|
/my-bucket/image.jpg | objects.example.com/my-bucket/image.jpg |
/image.jpg (no bucket) | No such bucket, returns 404 |
All public buckets on the instance are reachable this way through one CDN hostname. Objects must be publicly readable, through the bucket's anonymous HTTPS access setting or a bucket policy. Requests for private objects return the origin's 403 to the visitor. Bucket listings are not served.
To serve a single bucket at the root of the CDN hostname, use the Origin URL type with the bucket's virtual-host address, for example https://my-bucket.objects.example.com. The CDN then maps /image.jpg directly to that bucket.
Origin settings
| Setting | Default | What it does |
|---|---|---|
| Host header | Empty | The Host header sent to the origin. When empty, the hostname from the origin URL is used. Set it when the origin serves several sites by hostname, for example when the origin URL is an IP address. |
| Origin connect timeout | 10s | How long the edge waits to open a connection to the origin. |
| Origin response timeout | 60s | How long the edge waits for the origin to respond once connected. Increase it for slow origins or very large files. |
| Follow redirects | Off | When on, the edge follows redirects returned by the origin and caches the final response. When off, the redirect is passed to the visitor. |
| Forward Host header | Off | When on, the edge forwards the hostname the visitor requested, such as cdn.example.com, instead of the origin's own hostname. |
| Retry failed requests | Off | When on, the edge retries the origin once if the first attempt fails. |
Caching
| Setting | Default | What it does |
|---|---|---|
| Smart Cache | On | Caches static files such as images, video, stylesheets, and scripts. Dynamic responses, including HTML, are never cached. Cache-Control headers from the origin are respected. |
| Query string ordering | On | Sorts query parameters into a fixed order before caching, so ?a=1&b=2 and ?b=2&a=1 share one cache entry. |
Cache lifetimes can be overridden per path with edge rules.
Purging the cache
Purge cache removes every cached object for a CDN from all edge locations. The next request for each file is fetched from the origin again. Purging is global, cannot be undone, and causes a short increase in origin load while the cache refills.
Cached copies are served until they expire or are purged, regardless of changes at the origin. Purge after revoking public access to content or switching the origin, or the old copies keep being served.
