server.headers
- Type:
Record<string, string | string[]> - Default:
undefined
Adds headers to all responses sent from Rsbuild server. This configuration directly leverages Node.js response.setHeader() method under the hood.
If the header already exists in the to-be-sent headers, its value will be overwritten.
Tip
To set CORS headers like Access-Control-Allow-Origin, use server.cors option.
If both server.headers and server.cors are used, server.headers will override server.cors.
Usage
The server.headers option accepts an object where:
- Keys are header names (case-insensitive)
- Values are either a string or an array of strings
rsbuild.config.ts
Multiple values
Use an array of strings to send multiple headers with the same name.
rsbuild.config.ts

