Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java, Tomcat : AN invalid character was present in the cookie value

I am working a SPring-MVC project where I am trying to set the cookie. I am using Tomcat7, And I have already set the cookie processor in context.xml to Rfc6265CookieProcessor. Currently I am getting the following error.

Error log :

HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: An invalid character [44] was present in the Cookie value

type Exception report

message Request processing failed; nested exception is java.lang.IllegalArgumentException: An invalid character [44] was present in the Cookie value

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: An invalid character [44] was present in the Cookie value
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:979)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

Cookie values to be set : The spaces are not actually there, got them while reformatting in IntelliJ to get them in one paragraph :

  s.d774b7c6eabba92fce3edbed8a9b003b,
s.bdf5f951e4ab858aac87fb182439f57f,
s.e77bd0cd86b4af86c4a550ec11d71d4c,
                        s.431334e112350c9d545f7a44cbcc530d,
                        s.6e6057e5483b538cf9c6daf2934fd825,
                        s.ea2438094c8631123fab3bf3efb7ec17,
                        s.e17b1d9dd1b9702ca8c9e95d30906dd5, s .3f 3 c8f3fc19597025ef87dafc0fb277a, s .5531
                b742d6e12717f4071818b5861bd2, s .420811998d
                b14d0a68dd9e3d3c04849f, s.d8ed1aa3b0a2e513d449a96182898160, s.f3b5784d6e777032c6b7576e7d824af0, s .69
                bc19557e43fcfa83816f427b60a09d, s .5677087e bc57003436c55f49fceff5cb, s .5f
                a872b3e84fd69618534940034e1adb, s.fe4184c9b925ddf04def79c0c55392ca, s .74e4438d 05f 267
                c48297a0c66a7dbeba, s .95e c071a356cf1998d809267006725db, s .9 b72a01cfda4509833c1f0c7bf2afdac, s .5240f
                10897d 2f 96f 49d 0328 a2521519c, s .518 cd1d749fbba6540424874d64c5443
like image 330
We are Borg Avatar asked Nov 03 '16 11:11

We are Borg


1 Answers

Character 44 (comma) is not valid in a cookie value.

See https://www.rfc-editor.org/rfc/rfc6265 for more details.

like image 107
ryanbraganza Avatar answered Oct 21 '22 14:10

ryanbraganza