couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Franck Eyraud <>
Subject Re: Replication through reverse proxy and
Date Sat, 17 May 2014 22:35:36 GMT

> Some problem in parsing the headers, could it be because the node.js 
> library transform all the headers in lower case ?
I'm answering to myself, sorry for bothering, but it might interest some 
of you :

Yes, it seems it is the reason : couchdb wants the headers as it emits 
them, but node.js for some reason gives them in lower case, we can force 
them back to CouchDB format before forwarding to the client :

function uCaseWord(word) {
   switch(word) {
     case 'etag':return 'ETag';
     default: return word.replace(/^./,function(l){return 

function uCaseHeader(headerName) {
   return headerName.replace(/\w*/g,uCaseWord);

function couchDBHeaders(nodeHeaders) {
   var couchHeaders={};
   for (var i in nodeHeaders) {
   return couchHeaders;

After patching this, I realized that I'm working with node 0.10.28, but 
future version of node.js (>= 0.11.6) gives access to the Raw Headers 

Have a good night,


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message