Tomcat 8 is not able to handle get request with '|' in query parameters?

前端 未结 7 577
半阙折子戏
半阙折子戏 2020-11-27 04:19

I am using Tomcat 8. In one case I need to handle external request coming from external source where the request has a parameters where it is separated by |.

7条回答
  •  佛祖请我去吃肉
    2020-11-27 04:30

    Issue: Tomcat (7.0.88) is throwing below exception which leads to 400 – Bad Request.

    java.lang.IllegalArgumentException: Invalid character found in the request target. 
    The valid characters are defined in RFC 7230 and RFC 3986.
    

    This issue is occurring most of the tomcat versions from 7.0.88 onwards.

    Solution: (Suggested by Apache team):

    Tomcat increased their security and no longer allows raw square brackets in the query string. In the request we have [,] (Square brackets) so the request is not processed by the server.

    Add relaxedQueryChars attribute under tag under server.xml (%TOMCAT_HOME%/conf):

    
    

    If application needs more special characters that are not supported by tomcat by default, then add those special characters in relaxedQueryChars attribute, comma-separated as above.

提交回复
热议问题