Skip to content

How to set multiple "Set-Cookie" protocol headers for HTTP responses #1859

Answered by gdamore
nanji886 asked this question in Q&A
Discussion options

You must be logged in to vote

In fact, according to the HTTP 1/1 specification, the combining that is done is legal and expected. See RFC 2616 4.2, which says:

Multiple message-header fields with the same field-name MAY be
present in a message if and only if the entire field-value for that
header field is defined as a comma-separated list [i.e., #(values)].
It MUST be possible to combine the multiple header fields into one
"field-name: field-value" pair, without changing the semantics of the
message, by appending each subsequent field-value to the first, each
separated by a comma. The order in which header fields with the same
field-name are received is therefore significant to the
interpretation of the combined fiel…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@nanji886
Comment options

Answer selected by gdamore
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants