How can I disable gzip in playframework by configuration

java

(Xia Deng) #1

How can I disable gzip in playframework by configuration? I had tried
1.play.modules.disabled += controllers.AssetsModule
2.change http.headers opration
3.compressionEnabled

But all that can not work. What shall I do ?


(Patrick Li) #2

gzip is done through a filter, so just disable it in your application.properties file

play.filters.disabled += play.filters.gzip.GzipFilter

See https://www.playframework.com/documentation/2.7.x/GzipEncoding


(Xia Deng) #3

Yes, I had tried that alreay, so bad, it did not work. And my verison is 2.5X,
My purpose is to block gzip request.


(Xia Deng) #4

echo ‘{“inviteToken”:1234}’ | gzip | curl -i -k -X ‘POST’ -H ‘Content-Encoding: gzip’ -H ‘Content-Type: application/json;charset=utf-8’ --data-binary @- -H “Accept: application/json, text/plain, /https://XXXXXXX/tenants/global/init, this is my command, so bad, the play can read the inviteToken:1234


(Marcos Pereira) #5

Okay, so, disable gzip support and blocking gzip requests are two distinct things. If you want to block them, you can create a filter that inspects the request headers and returns a 400 response. See https://www.playframework.com/documentation/2.7.x/ScalaHttpFilters.

Best.