Koyeb CDN Ignores max-age Cache-Control headers

I set the max-age to 30 days but the Koyeb CDN clears the cache after 30-60 seconds.


  1. Deploy a (Next.js) app, set cache headers on the static assets like fonts, CSS, and JS files.
    Something like: Cache-Control: public, max-age=31536000, immutable or Cache-Control: s-maxage: 2592000

Here is a way to cache the /asset folder in Next.js:

const nextConfig = {
headers() {
    return [
        source: '/:all*(css|js|gif|svg|jpg|jpeg|png|woff|woff2)',
        locale: false,
        headers: [
            key: 'Cache-Control',
            value: 'public, max-age=31536000',
  1. Request them a couple times and there will be cache hits, great. But wait 60 seconds and all the files will be a cache miss.

A workaround:

  1. Add domain to Cloudflare and proxy requests through there.
  2. Cloudflare will respect the cache control headers and cache for much longer, even on the free plan.

Disadvantages of using Cloudflare on top of Koyeb:

  1. Adds 30-60 ms TTFB latency to all your requests. This is because it routes through the proxy first, then to your app.
  2. Does not clear the cache on redeploys like Koyeb does.


Blog post:

I would appreciate if someone at Koyeb could confirm if this is a bug or intended behavior?