0

My application is running on WildFly application server with NGINX proxy server on front. I have enabled gzip on WildFly and everything working fine when I access WildFly directly. But when I accessed via proxy there is content-encoding: gzip header in response. So I added gzip configuration in nginx and it worked. So what is the best method to enable gzip when you application is fronted with proxy server?

Valsaraj Viswanathan
  • 1,473
  • 5
  • 28
  • 51
  • AFAIK the best approach is to gzip it on backend, then Nginx will not double-zip it and serve compressed response to the client. – Anatoly Jul 10 '15 at 21:11
  • Yes, but in that case I can't see content-encoding: gzip header in response. When I configure gzip in nginx, header is present in response. – Valsaraj Viswanathan Jul 12 '15 at 10:20
  • just add a header: *add_header Content-Encoding $upstream_http_content_encoding;* – Anatoly Jul 12 '15 at 10:25
  • I have removed gzip enabling in proxy and just added this header but there is no change in response. When I hard code "gzip" instead of $upstream_http_content_encoding, it's showing error for resources that are not gzipped. That means control reaches here but due to some reason it's not setting $upstream_http_content_encoding in response header. – Valsaraj Viswanathan Jul 13 '15 at 06:52

0 Answers0