URIError: URI Malformed #1331

eknkc opened this Issue Sep 15, 2012 · 2 comments


None yet
3 participants

eknkc commented Sep 15, 2012

Lately, we have a lot of errors logged, like this;

URIError: URI malformed
    at decodeURIComponent (native)
    at parse (/srv/node/stable/node_modules/express/node_modules/cookie/index.js:46:24)
    at Array.forEach (native)
    at Object.parse (/srv/node/stable/node_modules/express/node_modules/cookie/index.js:34:11)

This is related to a malformed cookie, being fed into decodeURIComponent of cookie middleware. I don't know the reason of the malformed cookie, nor argue that cookie middleware is broken.

However, Express should just ignore such a problem and go with it, ignoring that cookie alltogether. For what it's worth, an included javascript (say, google analytics), a custom cookie, or a browser in mental meltdown (ie..) could trigger such an issue.

I could replicate it by sending this header;

Cookie: a=%



tj commented Sep 16, 2012

a console.warn would probably suffice

af commented Jan 1, 2013

@visionmedia This issue can be closed now, since express v3.0.5 uses v.0.0.5 of the cookie module, where this is fixed. shtylman/node-cookie#8 has the details.

tj closed this Jan 1, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment