-
Notifications
You must be signed in to change notification settings - Fork 812
Description
Describe the bug
When the openfeign request compression is used the the FeignContentGzipEncodingInterceptor
adds two values to the header:
addHeader(template, HttpEncoding.CONTENT_ENCODING_HEADER, HttpEncoding.GZIP_ENCODING, HttpEncoding.DEFLATE_ENCODING);
The compression itself is dependent on the used client. The feign default client (https://github.com/OpenFeign/feign/blob/master/core/src/main/java/feign/Client.java) can either use gzip compression or deflate compression. If both headers are present it will currently choose gzip but the headers remain unchanged.
According to the Content-Encoding documentation (https://datatracker.ietf.org/doc/html/rfc2616#section-14.11) the header indicates that both compressions have been applied. The default client only applies one so the receiving server (if it handles the Content-Encoding header correctly) will first try to decompress with defalte which fails.
Sample
Can be reproduced by using a simple spring boot app using spring-cloud-starter-openfeign and setting up a client which will sent a body with request compression. The headers will contain Content-Enconding: gzip, deflate
but the compressed body will only be gzip data.