Spring Boot Cookie

Cookie character problem

Tomcat doesn’t allow to use ‘=’ as cookie by default.
Spring Boot Controller receive cookie and remove(trim) = automatically.

To enable = etc…, we need to use a bit technical

System.setProperty("org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUALS_IN_VALUE", "true");

Insert this code before SpringApplication.run
After inserting, Spring Boot Controller can receive cookies which include ‘=’.

Other solution
Don’t use = character as cookie.
Save URLEncoded cookie instead of using raw cookie.
Spring Boot received cookie as raw(decoded) @CookieValue, @Valid,


URLEncoder.encode(cookiestr, "UTF-8")

cookiestr is raw value