Add Duplicate HTTP Response Headers in Nodejs
Problem
I am looking for adding duplicate HTTP headers in the http response in Nodejs, something like:
HTTP/1.1 206 Partial Content
Content-Length: 1234567
Content-Type: video/ogg
Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
I am using the http module provided by Nodejs and when I send the response header, I can only define one "Content-Type" header:
var header = {};
header['Content-Type'] = "video/ogg";
or
header['Content-Type'] = "multipart/byteranges; boundary=THIS_STRING_SEPARATES";
Is it possible to include both "Content-Type" in the response? Thanks.
Problem courtesy of: afterglowlee
Solution
Currently, this is an open issue with Node.js itself. You could circumvent this by using one Content-Type with comma separated values, using this patch, or if possible, implementing an X-Content-Type
header. Multiple X-
header values are currently concatenated into one.
Solution courtesy of: wayoutmind
Discussion
View additional discussion.