Nginx substitutions with GZIP responses
I have a requirement to do substitutions on reverse proxied responses from servers where GZIP is required and was wondering if there was any way of doing this on NGINX. The main use case is replacing image sources depending on user location.
Obviously, I’ve looked at the built in subs module(which doesn’t support regex) and the open source one (subs filter) here
Note in my situation it’s not possible for me to control what the upstream has turned on/off, I don’t control those servers.
So it would appear that I’d need to disable gzip between proxy and server(via a header I guess?), substitute, and then gzip before sending the response?
Is this even possible and does anyone have an example please?
Read more here: Source link
