Spring Cloud Gateway - Compress all the responses

Viewed 644

I am using the Spring Cloud Gateway, version 2.2.7.RELEASE, as a gateway for a microservice application. We developed every microservice using Spring Boot. The responses coming from microservices are not compressed.

I am searching how to perform compression of responses directly in the gateway, maybe as a GlobalFilter. However, I am not finding any reference on the Internet.

Is it possible?

1 Answers

It's easier than I thought. It is sufficient to enable the property server.compression.enabled in the application.yml file. If you want to have a list of all the available options, look at the official documentation.

WARNING: The proxied microservices don't have to compress the response, too.

Related