Not sure if the issue is with GeoServer or GeoWebCache, but if I issue a WMS request containing the CQL_FILTER parameter whose value contains a percent sign, as in “property LIKE '%term%' ”, GWC fails to cache the result and issues the geowebcache-miss-reason response header containing the exception (the correct image is served, just never cached), even though the entire WMS request is properly URL-encoded.
$ curl -v -o tile.png "http://example.com/geoserver/wms/service?format=image%2Fpng8&format_options=antialias%3Anone&env=color%3A00ff00%3Bopacity%3A0.5&cql_filter=filename%20like%20%27%25building%25%27&srs=EPSG%3A3857&transparent=true&exceptions=application%2Fvnd.ogc.se_xml&styles=test%3Apolygon&tiled=true&feature_count=101&service=WMS&version=1.1.1&request=GetMap&layers=test%3Alayer&bbox=-9092337.388578286%2C3546830.9864887483%2C-9092184.514521716%2C3546983.8605453186&width=256&height=256"
< HTTP/1.1 200
< X-Frame-Options: SAMEORIGIN
< Access-Control-Allow-Origin: *
< Set-Cookie: GS_FLOW_CONTROL=GS_CFLOW_-7d59bd29:1783ead6d08:-7ceb
< X-Control-flow-delay-ms: 0
< Cache-Control: max-age=3600, must-revalidate
< geowebcache-cache-result: MISS
< geowebcache-miss-reason: exception occurred: IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 1 in: "bu"
< Expires: Wed, 17 Mar 2021 20:07:43 GMT
< Content-Disposition: inline; filename=test-layer.png
< Content-Type: image/png; mode=8bit
< Transfer-Encoding: chunked
< Date: Wed, 17 Mar 2021 19:07:43 GMT
If I reissue the same request such that I intentionally double URL-encode the percent sign so that “%25” becomes “%2525”, then it works.
... &cql_filter=filename%20like%20%27%2525building%2525%27& ...
I’m not sure if GeoServer, when directly integrated with GWC, relays the request internally through HTTP but fails to re-encode the query parameters, or something else, but the client side should not have to resort to double URL-encoding of percent signs.
|