Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] proxy: GzipContentTransformer and Content-Length headers

Thanks for the reference -- maybe I can just include that interceptor in my Server and it'll all just work.
Failing that, I can just copy the logic.

One key bit was setting Content-Length to -1 -- I hadn't figured out how to compute it
without buffering the entire response, and I guess it's not surprising the answer is "you can't".

> On Nov 3, 2017, at 3:02 PM, Greg Wilkins <gregw@xxxxxxxxxxx> wrote:
> 
> 
> Steven,
> 
> Jetty GzipContentTransformer is very much just a component in what must be a bigger solution dealing with headers and lengths.   For example a middle man might inflate content, examine it and then deflate it again before passing it on, so headers might not need to be adjusted.   Or it might inflate/deflate content, in which case headers do need to be adjusted.
> 
> You can see what we do serverside in https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHttpOutputInterceptor.java#L153-L193
> 
> We use the  the "incorrect" widely-accepted 'Content-Encoding'  because it works better with browsers :)
> 
> cheers
> 
> 
> On 4 November 2017 at 05:22, Steven Schlansker <stevenschlansker@xxxxxxxxx> wrote:
> I'm trying to use the GzipContentTransformer to implement transparent gzip-ing of our backend responses.
> 
> It looks like the code handles the actual compression fine, but does not handle changing the HTTP headers to match the transformed input.
> Additionally, there's multiple 'styles' of transparent gzipping, the "incorrect" widely-accepted 'Content-Encoding' and the not-widely-supported-but-more-correct Transfer-Encoding approach.
> 
> Once you start digging in to exactly what to do, you also have to start munging ETags.
> Then you find a long history of both nginx and mod_deflate[1] getting it wrong...
> 
> Does the Jetty community have an example, or any recommendations?
> I looked for uses of GzipContentTransformer but didn't find any samples.
> 
> [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=39727
> 
> 
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
> 
> 
> 
> --
> Greg Wilkins <gregw@xxxxxxxxxxx> CTO http://webtide.com
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


Back to the top