The Set-Cookie
HTTP response header is used to send a cookie from the server to the user agent, so that the user agent can send it back to the server later. To send multiple cookies, multiple Set-Cookie
headers should be sent in the same response.
Warning: Browsers block frontend JavaScript code from accessing the Set-Cookie
header, as required by the Fetch spec, which defines Set-Cookie
as a forbidden response-header name that must be filtered out from any response exposed to frontend code.
For more information, see the guide on Using HTTP cookies.
Header type | Response header |
---|---|
Forbidden header name | no |
Forbidden response header name | yes |