pedestal

souenzzo 2019-02-18T18:01:24.031700Z

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

2019-02-18T18:04:08.032400Z

@souenzzo, by private you mean that the csrf token is required?

souenzzo 2019-02-18T18:04:16.032600Z

yep.

2019-02-18T18:05:34.033700Z

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.

๐Ÿ‘ 1
2019-02-18T18:44:25.034100Z

Thanks!

souenzzo 2019-02-18T19:05:31.034300Z

is there any quick(dirty) workaround for this problem?

2019-02-18T19:07:42.034600Z

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

๐Ÿ‘ 1
2019-02-18T19:08:10.034900Z

oh

2019-02-18T19:08:19.035100Z

@souenzzo I think I know what it is

2019-02-18T19:08:57.035500Z

includedMethods
List of HTTP methods to compress. If not set, only GET requests are compressed.

2019-02-18T19:09:19.035700Z

@souenzzo try specifying POST as an included method

souenzzo 2019-02-18T19:14:16.035900Z

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?

2019-02-18T19:16:24.036100Z

If you create a PR that would be great!

๐Ÿ‘ 1
souenzzo 2019-02-18T19:28:13.036400Z

Thanks @ddeaguiar ๐Ÿ˜‰ My POST respose goes from 5M to 300K

2019-02-18T19:30:35.036600Z

:thumbsup:

souenzzo 2019-02-18T21:06:08.036800Z

https://github.com/pedestal/pedestal/pull/609