nickva commented on issue #2369: Cluster to single node replication prints 
"Could not parse cookie from response headers cookie_format_invalid"
URL: https://github.com/apache/couchdb/issues/2369#issuecomment-574272742
 
 
   @m90 
   
   I couldn't reproduce the issue on Ubuntu 18.04 with distro default nginx 
version and a with this config:
   
   ```
   # Default server configuration
   #
   server {
   listen 80 default_server;
   listen [::]:80 default_server;
   
   root /var/www/html;
   index index.html index.htm index.nginx-debian.html;
   
   server_name _;
           location / {
               proxy_pass http://localhost:15984;
               proxy_redirect off;
               #proxy_buffering off;
               proxy_set_header Host $host;
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
   }
   ```
   
   I had noticed in the code we would emit that error if we somehow got some 
other, non-CouchDB emitted cookie. So made PR to ignore those:
   
   https://github.com/apache/couchdb/pull/2454
   
   Also noticed the issue @seigel mentioned that we did not parse some of the 
cookie bits like expiration time properly. That field is not used, as we use 
max-age, but does indicate that if nginx somehow re-writes the cookie in a 
certain way the same parsing error might trigger in a different way and the 
cookie would not be found anymore. The parsing issue should be fixed in 
https://github.com/apache/couchdb/pull/2452 with the new web server component 
update.
   
   Thought I am still curios, if you get a chance to capture the traffic 
between client and proxy and proxy and CouchDB as to what was causing the issue 
in your case. Another way to do it is to re-build from source and add a few 
debug lines to this module:
   
   ```
   -spec parse_cookie(list()) -> {ok, age(), string()} | {error, term()}.
     parse_cookie(Headers0) ->
   +    couch_log:error("***** Headers0:~p", [Headers0]),
         Headers = mochiweb_headers:make(Headers0),
         case mochiweb_headers:get_value("Set-Cookie", Headers) of
             undefined ->
                 {error, cookie_not_found};
             CookieHeader ->
                 CookieKVs = mochiweb_cookies:parse_cookie(CookieHeader),
   +            couch_log:error("****CookieKVs:~p", [CookieKVs]),
                 CaseInsKVs = mochiweb_headers:make(CookieKVs),
   +            couch_log:error("-----> AuthSession:~p", [
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to