---
schema_version: "1"
id: 8435f0d8f8724edd8306339eb3ebcc4ec9ceef6f575bdf6e0c35e34b6b70355b
title: Cookie Names with Invalid Characters in Custom Code Cause Errors
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/commerce/264-0-0/rn_cookie_names_b2c_21_4_w9042535_la.md
canonical_url: https://help.salesforce.com/s/articleView?id=commerce.rn_cookie_names_b2c_21_4_w9042535_la.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: e6ffaa742bf157088bd546786899de514b709d3dedb9ddb6536abbff06d56292
description: Our servlet container is now upgraded to implement Java Servlet specification 4.0, which has stricter rules for cookie names. Any use of invalid characters in a cookie name, as described in RFC6265, which references RFC2068, now causes an exception.
products:
  - Commerce
  - B2C Commerce
release: "264"
---
# Cookie Names with Invalid Characters in Custom Code Cause Errors

Our servlet container is now upgraded to implement Java Servlet specification 4.0, which has stricter rules for cookie names. Any use of invalid characters in a cookie name, as described in RFC6265, which references RFC2068, now causes an exception.

How: To avoid the exception, in custom code, an invalid cookie name passed to the constructor `dw.web.Cookie` is now replaced by the underscore character. An error message is logged that shows the original cookie name and the sanitized name with the underscore characters.

Rework any custom code that results in invalid cookie names, since the server also drops incoming request cookies that include invalid characters. The invalid cookie never reaches the server as an incoming request.

#### See Also

- [Java Servlet 4.0 Specification](https://download.oracle.com/otndocs/jcp/servlet-4-final-spec/index.html)