Add Rack::Deflater middleware to production environment template #14299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some proxy servers, like nginx (recent versions) won't keep the ETag header if the gzip compression is enabled in the proxy-side as it would change the content. Also nginx doesn't support weak ETag yet.
In some cases, serving a full application directly with Puma, for instance, may be good enough for some applications with no need for load balancing and enabling gzip compression by default in production environments is a good default to support.
In other servers set-ups there may be a cluster of servers and the suggested approach in the guides of serving the assets directly from the proxy server by local assets location require them to be accessible in the same filesystem as the proxy server which may be a bit of burden in the deployment process. Another approach is to configure the proxy-server to cache those requests after the first access to the proxied url with the application serving the assets for the first access (not cached by nginx yet). But this approach doesn't work well in nginx if nginx is also responsible for gzipping the assets. Applying gzip compression directly in the backend avoid having to configure a new proxy in the path just to compress the content before it gets cached.