Security

When a Server Action is created and exported, it automatically generates a public HTTP endpoint by default, so it should be handled with caution.

This section illustrates the security features built into Next.js and explores the best security pratices that a Next.js developer should adopt.


To enhance security, Next.js includes the following built-in features:


A Next.js developer should adopt the following security pratices:


// next.config.js
/** @type {import('next').NextConfig} */
module.exports = {
  experimental: {
    serverActions: {
      allowedOrigins: ['my-proxy.com', '*.my-proxy.com'],
    },
  },
}

Read the blog here for more information about security best practices in Next.js.