Is Koyeb production ready? (for Next.js)

  1. I noticed Koyeb actually uses Vercel to host it’s landing page, not itself, why?

  2. How do I set cache headers for the Next.js html pages and static files? Html is never cached.

  3. Why do the Koyeb cache headers say this (nextjs css file) has a long cache time but it expires after 30 seconds?

Some pictures of Koyeb response, Koyeb waterfall, and Vercel waterfall last, same app.

There are 3 things to cache here, Vercel caches all these permanently and clears the cache on a new deploy.

  1. The HTML pages.
  2. Generated static assets like CSS and JS.
  3. Files in the /public folder like images or JS.

Edit:
Found how to cache the public folder when hosting outside of Vercel:

const nextConfig = {
headers() {
    if (process.env.NODE_ENV !== 'production') return []

    return [
      {
        source: '/:all*(css|js|gif|svg|jpg|jpeg|png|woff|woff2)',
        locale: false,
        headers: [
          {
            key: 'Cache-Control',
            value: 'public, max-age=31536000',
          },
        ],
      },
    ]
  },
}
1 Like

Exploring further here, one reason reason app.koyeb.com may feel slow is due to static assets not being cached. The html TTFB is also a bit slow.

The css file and fonts are blocking rendering, but take 150-700 ms instead of 50-100 ms if they were cached.

Otherwise I like the platform, builds well and nice metrics.

I can’t edit or delete the original post anymore… just ignore question 2 as it’s more a next.js question.

Question 3 still stands and essentially asks why the cache header is ignored.

Does Koyeb recommend using Cloudflare for your website with custom rules and such? How does that work if Koyeb already uses Cloudflare? Can’t find info in the docs about this.

This may already be possible, I haven’t tried to cdn cache next.js like this before.