spring-cloud / spring-cloud/spring-cloud-gateway
Issue with GatewayFilters and gzip
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked demo project's NonWorkingTests and WorkingTests, comparing behavior with compression enabled and disabled in Spring Boot and Spring Cloud Gateway. Trace how ModifyResponseGatewayFilter receives the gzip response and determine the expected handling of Accept-Encoding. Done should include a regression test covering the non-working configuration and confirming the intended response processing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100