For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/api/rspeedy.server.cors.md.
这是开发预览网站。请访问正式文档 lynxjs.org

Home > @lynx-js/rspeedy > Server > cors

Server.cors property

Configure CORS for the dev server or preview server.

Signature:

cors?: ServerConfig['cors'] | undefined;

Default Value

Uses Rsbuild's default CORS options.

  • Set to an object to enable CORS with the specified options.

  • Set to true to enable CORS with the default options (allows all origins, not recommended).

  • Set to false to disable CORS.

See Rsbuild - server.cors for details.

Example

export default {
  server: {
    cors: {
      origin: 'https://example.com',
    },
  },
}