An invalid domain [.<domain.tld>] was specified for this cookie

Document ID : KB000077040
Last Modified Date : 10/04/2018
Show Technical Document Details
Customer is integrating with Google reCaptcha. It fails with the following in the tomcat log:

2018-04-10 00:00:41,682::[http-nio-8081-exec-4] - ReCaptchaServlet: java.lang.IllegalArgumentException: An invalid domain [.<domain.tld>] was specified for this cookie 

How can this be resolved?
Set tomcat to use LegacyCookieProcessor (because Rfc6265CookieProcessor complies with RFC6265 which does not allow domains beginning with non-alphanumeric characters): 

1. Edit the Tomcat/conf/content.xml 

2. Add the statement in betweeen the <context> and </context> tags: 

<CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor" /> 

3. Restart Tomcat.