← Back to Blog
CDNPerformanceThailand

CDN Configuration for Fast Websites in Thailand

13 May 2026 · by Yunmin Shin

What Is a CDN and Why Does Location Matter for Thailand?

A Content Delivery Network (CDN) is a geographically distributed network of servers that caches your website's static files — images, CSS, JavaScript, fonts — and serves them from the server physically closest to the user.

Without a CDN, a Thai user visiting a website hosted in the United States waits for data to travel roughly 15,000 kilometers and back. That round trip adds 150–300ms of latency to every request, before any computation happens. With a CDN that has a Point of Presence (PoP) in Singapore or Bangkok, that same data travels a few hundred kilometers instead — reducing latency to under 20ms.

For Thai businesses, this is not a marginal improvement. It is the difference between a 1-second page load and a 3-second page load.

What CDN Should Thai Websites Use?

Cloudflare is the most widely used CDN globally and has a PoP in Bangkok. The free plan covers most small and medium Bangkok business websites — it includes unlimited bandwidth, DDoS protection, SSL, and basic caching. The Bangkok PoP means Thai users often get CDN-served content with single-digit millisecond latency.

Vercel Edge Network is built into every Vercel deployment. Static files and Next.js cached pages are served from Vercel's edge nodes, including Singapore. If you are already on Vercel, you get a fast CDN automatically.

AWS CloudFront with a Singapore origin is appropriate for larger applications already using AWS infrastructure. It has more configuration options but requires more setup than Cloudflare.

How Do You Configure Cache Headers Correctly?

The CDN can only cache what your server tells it to cache. Set Cache-Control headers appropriately:

# Static assets (images, fonts, JS, CSS with hashed filenames)
Cache-Control: public, max-age=31536000, immutable

# HTML pages (revalidate frequently)
Cache-Control: public, max-age=0, must-revalidate

# API responses (do not cache unless intentional)
Cache-Control: private, no-store

Next.js handles these defaults correctly for static assets. For API routes and page routes, configure caching explicitly using export const revalidate = 3600 (revalidate every hour) or export const dynamic = "force-static" for fully static responses.

How Do You Purge the Cache?

When you update content — a product price, a hero image, a blog post — you need the CDN to serve the new version immediately rather than serving the cached old version for hours.

Cloudflare provides a cache purge API. Trigger it from your Next.js revalidation workflow when content changes:

curl -X POST "https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache" \
  -H "Authorization: Bearer {token}" \
  --data '{"files":["https://yoursite.com/products/item-slug"]}'

Vercel's revalidatePath and revalidateTag functions handle this automatically for Next.js's built-in caching layer.

What About Images Specifically?

Images are typically 60–80% of a page's total byte size. Beyond CDN delivery, optimize images before they reach the CDN:

  • Convert to WebP or AVIF format (30–50% smaller than JPEG at equivalent quality)
  • Serve images at the correct display dimensions, not larger
  • Use lazy loading for off-screen images

Next.js's <Image> component handles all of this automatically when the CDN is Vercel or Cloudflare with image transformation enabled.

Ready to Build Something Fast?

Get a free quote on LINE. We reply within 24 hours.

Ready to build something fast and scalable?

Get a free project quote on LINE. We reply within 24 hours.

무료 견적 on LINE