Today I Learned

TIL, 2023-11-28

An In-Depth Guide to Configuring Your Next.js Project with next.config.js

Reference

  • Asset Prefix: By offloading static assets to distributed servers, they can access your website from servers closer to their location.
  • When deploying to Vercel, a global CDN is automatically configured. For other deployment, add asset prefix.
  • Base path
  • Compression: By default, will have
module.exports = {
  compress: false,
};
  • Custom build directory
  • Env variables.
  • Etags for caching (by default, has).
  • Custom HTTP headers - headers() - ex: X-Frame-Options.
  • HTTP Keep-Alive.
  • Image loader (images).
  • Incremental handler: By default, we use the filesystem cache for data fetching and caching. You can have a different cache handler path though.
  • x-powered-by header.
  • Redirects and rewrites - array of objects that contains source, destination, and permanent properties.

This project is maintained by daryllxd