-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support transparent response body compression #119
Comments
I'have recently written a mime type aware gzip handler, If you like, just copy over the code and tests to fabio. |
Shouldn't this work by just setting the |
@magiconair no, i was focusing on apply compression to responses proxied by fabio - what @smancke has suggested with his gzip handler Cheers |
@tanuck so you want fabio to inject the |
no, just leave that to the browser/client - but if it's present, have the same sort of feature as nginx, to compress the response from the upstream service before sending it to the client and then setting the |
@tanuck Sorry, I don't get it. Isn't that exactly the behavior of the |
@tanuck I think I get it. You want some responses to be compressed independent of whether the browser has requested compression, i.e. |
@magiconair no not quite. So i'm trying to get a fabio setup that can replicate my current "nginx as a reverse proxy" configuration. So right now I have an nginx service, proxying requests to various dockerized microservices. The microservices don't perform any gzip compression. Instead, we use the nginx gzip module. If the browser sends So my question is whether this can be replicated with fabio, whether responses from upstream services can be compressed returning the response to the client/browser. The http.Handler that @smancke linked is pretty much what I mean, so some way to integrate that into fabio based on a config setting? Cheers |
@tanuck ah, I think the penny finally dropped. I was under the impression that the Go std lib already does this but it looks like it doesn't. The |
Awesome :) I'm happy to help out with the implementation if needed. What do you think is the best way to configure this? In |
I'll let you know when I have a patch ready. For now this needs to be a global option since I don't have a way to express this on the routes yet. |
@smancke any objections if I incorporate your code with proper attribution? License is MIT. |
@smancke just read your first comment again where you're ok with this. |
@magiconair Yes, please just take it. |
This patch adds an option 'proxy.gzip.contentype' which enables transparent response body compression if the client requests it, the content type of the response matches the proxy.gzip.contenttype regexp and the response is not already compressed. The gzip handler is mostly based on the code from @smanke from https://github.com/smanke/handler/gzip.
I've finally found the time to implement this. I've mostly taken your code @smancke and replaced only the |
+1 please :) |
@numard If this can wait until the end of next week then I have the perfect thing to work on while I'm at your office. Should be in on Friday, 28 Oct and the week after. |
This patch adds an option 'proxy.gzip.contentype' which enables transparent response body compression if the client requests it, the content type of the response matches the proxy.gzip.contenttype regexp and the response is not already compressed. The gzip handler is mostly based on the code from @smanke from https://github.com/smanke/handler/gzip.
This patch adds an option 'proxy.gzip.contentype' which enables transparent response body compression if the client requests it, the content type of the response matches the proxy.gzip.contenttype regexp and the response is not already compressed. The gzip handler is mostly based on the code from @smanke from https://github.com/smanke/handler/gzip.
This patch adds an option 'proxy.gzip.contentype' which enables transparent response body compression if the client requests it, the content type of the response matches the proxy.gzip.contenttype regexp and the response is not already compressed. The gzip handler is mostly based on the code from @smanke from https://github.com/smanke/handler/gzip.
Merged. |
Hi,
Again, I don't know whether there's scope for this in fabio - but have you thought about applying compression to proxied responses?
Possibly supplying a list of mime types in the properties file that will be gzip'ed etc?
Cheers
The text was updated successfully, but these errors were encountered: