Hello
I'm using context-configurator
to enable gzip
, but it works just on "public" routes.
I use csrf
, so my get
's are public and post
's private
::http/enable-csrf {}
::http/enable-session {}
On get's, gzip works, on post's not
My context config:
(defn context-configurator
[^ServletContextHandler context]
(let [gzip-handler (GzipHandler.)]
(.setExcludedAgentPatterns gzip-handler (make-array String 0))
(.setGzipHandler context gzip-handler))
context)
https://github.com/pedestal/pedestal/blob/master/samples/servlet-filters-gzip/src/gzip/service.clj#L61@souenzzo, by private you mean that the csrf token is required?
yep.
Hm, Iโd expect that to behave similarly. Iโd explore that further. If you have a minimal project reproducing the issue that would help.
Thanks!
is there any quick(dirty) workaround for this problem?
I donโt know. I donโt understand why csrf would interfere with compression and my gut feeling is that itโs a red herring
oh
@souenzzo I think I know what it is
https://www.eclipse.org/jetty/documentation/9.4.14.v20181114/gzip-filter.html
includedMethods
List of HTTP methods to compress. If not set, only GET requests are compressed.
@souenzzo try specifying POST as an included method
Nice!
Working with (.addIncludedMethods gzip-handler (into-array ["GET" "POST"]))
Should I do a PR to add a comment with this link in the example? or you can add?
If you create a PR that would be great!
Thanks @ddeaguiar ๐ My POST respose goes from 5M to 300K
:thumbsup: