Loading

HTTP Gzip Responses with Mule 4

Publiseringsdato: Aug 4, 2025
Oppgave

GOAL

Produce a gzipped response to a HTTP Request using Mule 4.

On the client side, you can advertise a list of compression schemes that will be sent along in an HTTP request. The Accept-Encoding header is used for negotiating content encoding.
By using `Accept-Encoding: gzip` header you are requiring the server to return this kind of content. The server responds with the scheme used, indicated by the Content-Encoding response header. (Content-Encoding: gzip)

Trinn

The process of compression in Mule 4 is done by the Compression module.

User-added image
Find the complete source code attached that takes care of the `Accept-Encoding` value send as header.

To test it you can use cURL: 
curl -sH 'Accept-encoding: gzip' localhost:8081 | gunzip - 
 

Disclaimer: This solution provides a suggestion that should be considered in conjunction with your specific use-case and requirements and does not represent a complete solution for all circumstances.

Flere ressurser
Gzip example
Knowledge-artikkelnummer

001114556

 
Laster
Salesforce Help | Article