On Thu, Jan 29, 2015 at 08:41:04PM +0000, Jesse Hathaway wrote:
> The HAProxy configuration manual contains the following note:
> 
> > Compression is disabled when:
> >   * HTTP status code is not 200
> 
> However, many rest APIs send back a 201 status code after receiving a POST.
> 
> What is the rationale for only compressing responses with a 200 status code?

I've found it in this commit message :

  commit d300261babe838ac3bdd2f5e2353980845fb3929
  Author: William Lallemand <[email protected]>
  Date:   Mon Nov 26 14:34:47 2012 +0100

    MINOR: compression: disable on multipart or status != 200
    
    The compression is disabled when the HTTP status code is not 200, indeed
    compression on some HTTP code can create issues (ex: 206, 416).
    
    Multipart message should not be compressed eitherway.

Note that this was one of the very early commits of compression, at a time
where it was only starting to work and we were extremely careful. Now that
compression works well, I think we could broaden the scope of status codes,
and explicitly allow 2xx except 204-206. From what I'm seeing, at least 200,
201, 202, and 203 may contain a response subject to compression.

Well, maybe we could at least allow 200-203 then. What do you think ?

Willy


Reply via email to