Java, Tomcat: invalid character present in cookie value

I am working on a SPring -MVC project where I am trying to set a cookie. I am using Tomcat7 and I have already set the cookie processor in context.xml on Rfc6265CookieProcessor. I am currently 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 ​​that need to be set: spaces are actually not there, got them, reformatted 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
+4
source share
1 answer

The character 44(comma) is not valid in the cookie value.

See https://tools.ietf.org/html/rfc6265 for more details .

+3
source

Source: https://habr.com/ru/post/1659708/


All Articles