You can set these system properties in command line that starts Tomcat. For example, you can have file setenv.bat
(on setenv.sh
if you are on linux) in Tomcats bin
folder with following content:
set "CATALINA_OPTS=%CATALINA_OPTS% -Dfile.encoding=UTF8 -Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=true -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
This file is preferred way of setting properties for Tomcat.
Now, FWD_SLASH_IS_SEPARATOR
is by default set to false
. If you set STRICT_SERVLET_COMPLIANCE
to true
, the value of FWD_SLASH_IS_SEPARATOR
will be also set to true
(and values of some other properties). However, you can set it explicitly to false
, e.g. using the following in your setenv
file is fine:
-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
-Dorg.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR=false
This is also what I suggest when someone sets STRICT_SERVLET_COMPLIANCE
to true
, to always disable the FWD_SLASH_IS_SEPARATOR
. Otherwise, the cookie Path value will be sent quoted (e.g. "\"
) and all browsers as of today, except Opera, do not recognize this and would e.g. fail to track the session.