Note: please note that Liferay has renamed its Liferay Experience
Could offerings to Liferay SaaS (formerly LXC) and
Liferay PaaS (formerly LXC-SM).
Issue
- Trying to access an URL that contains special characters the page fails to load showing a HTTP Status 400 - Bad Request Tomcat page.
- Also the following logs can be found:
java.lang.IllegalArgumentException: Invalid character found in the request target [/<CLIENT URL CONTAINING SPECIAL CHARACTER>].
The valid characters are defined in RFC 7230 and RFC 3986 at
org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:494) at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:271) at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891) at
org.apache.tomcat.util.net.Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1703) at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at
org.apache.tomcat.util.net.AbstractEndpoint.processSocket(AbstractEndpoint.java:1190) at
org.apache.tomcat.util.net.Nio2Endpoint$Nio2SocketWrapper$2.completed(Nio2Endpoint.java:634) at
org.apache.tomcat.util.net.Nio2Endpoint$Nio2SocketWrapper$2.completed(Nio2Endpoint.java:612) at
java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:127) at
java.base/sun.nio.ch.Invoker$2.run(Invoker.java:219) at
java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) at
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at
java.base/java.lang.Thread.run(Thread.java:829)
Environment
- Liferay PaaS 7.3+
Resolution
- This happens because client is using special characters that aren’t supported by default.
- In order to change the parser config we need to modify the server.xml file and add the following:
relaxadoPathChars="[]|"
relaxadoQueryChars="[]|{}^\`"<>"
- For Liferay PaaS you can find this file in $REPO/liferay/configs/$ENVIRONMENT/tomcat/conf/server.xml and deploy it to make the change.
Additional Information
Subscriber Exclusive Content
A Liferay Enterprise Subscription provides access to over 1,500 articles that include best practices, troubleshooting, and other valuable solutions. Sign in for full access.
Sign In