-
Bug
-
Resolution: Done
-
Critical
-
8.0.0.GA-CR1, 8.0.0.GA-CR2
-
None
-
False
-
None
-
False
-
-
-
-
-
-
+
-
-
I have configured EAP to compress response if the output is grated than 500 bytes:
/subsystem=undertow/configuration=filter/gzip=gzipFilter:add() /subsystem=undertow/server=default-server/host=default-host/filter-ref=gzipFilter:add(predicate="not request-smaller-than(500)")
I have following snippet of REST resource (deployment is attached)
@Path("test") @ApplicationPath("rest") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class DemoApplication extends Application { @GET @Path("short-class") public MyData shortClass() { return new MyData("ok"); } @GET @Path("long") public MyData longContent() { return new MyData("long text".repeat(1000)); } public static class MyData { private String data; public MyData(String data) { this.setData(data); } public String getData() { return data; } public MyData setData(String data) { this.data = data; return this; } } } }
I expect /rest/test/long produce compressed response and /test/test/short-class non-compressed. However, with 8.0.0.GA.CR2 (and CR1) it is compressed anyway (see Content-Length and Content-Encoding headers):
$ curl -X GET -H 'Accept: */*' -H 'Accept-encoding: gzip' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/short-class' HTTP/1.1 200 OK Content-Encoding: gzip Connection: keep-alive Content-Type: application/json Content-Length: 33 Date: Fri, 24 Nov 2023 21:58:40 GMT Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: <FILE>" to save to a file. $ curl -X GET -H 'Accept: */*' -H 'Accept-encoding: gzip' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/long' HTTP/1.1 200 OK Content-Encoding: gzip Connection: keep-alive Content-Type: application/json Content-Length: 77 Date: Fri, 24 Nov 2023 21:58:44 GMT Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: <FILE>" to save to a file.
On the other hand, with 8.0.0.Beta I get expected results:
$ curl -X GET -H 'Accept: */*' -H 'Accept-encoding: gzip' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/short-class' HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json Content-Length: 13 Date: Fri, 24 Nov 2023 22:01:12 GMT {"data":"ok"} $ curl -X GET -H 'Accept: */*' -H 'Accept-encoding: gzip' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/long' HTTP/1.1 200 OK Content-Encoding: gzip Connection: keep-alive Content-Type: application/json Content-Length: 77 Date: Fri, 24 Nov 2023 22:01:15 GMT Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: <FILE>" to save to a file.
To summarize: The changes introduced by WFLY-17372 inadvertently changes the way the gzip filters are created such that they no longer apply predicates correctly.
- clones
-
WFLY-18813 Predicates not applied correctly to gzip filters
- Closed
- is cloned by
-
JBEAP-26172 (7.4.z) Predicate not request-smaller-than(500) isn't working with gzip filter
- Resolved
- is incorporated by
-
JBEAP-26770 (8.0.z) Upgrade EAP codebase to 8.0.3.GA-redhat-SNAPSHOT in EAP 8.0 Update 2
- Closed