Skip to content

Issue with GatewayFilters and gzip #4025

@ldomesjo

Description

@ldomesjo

I am using spring cloud gateway version 5.0.0 with spring boot 4.0.0 but I suspect this issue affects older versions as well.

The issue I am experiencing is that when I am using a ModifyResponseGatewayFilter and the client is asking for gzip response and the upstream host returns gzip the ModifyResponseGatewayFilter received a gzipped response message as well.

I can see that there has previously been work done to resolve this by implementing a GzipMessageBodyResolver which should decode the incoming payload as well as re-encode it on the way out
This does not seem to work however if you have not enabled compression in both spring boot as well as spring cloud gateway.

I setup this demo project which demonstrates the issue (with junit tests) https://github.com/ldomesjo/spring-cloud-gateway-gzip-issue

The project has two Tests, one named NonWorkingTests which are run without having compression enabled in spring boot as well as spring cloud gateway as well as another test WorkingTests which are run with compression enabled both in spring boot as well as spring cloud gateway.

Not sure what the proper solution should be here but perhaps spring cloud gateway should not be forwarding the Accept-Encoding: gzip when compression is not enabled in spring boot as well as spring cloud gateway?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions