Enable gzip for all phoenix responses
Enabling gzip for static assets in phoenix couldn't be simpler. In lib/myapp_web/endpoint.ex change gzip from false to true:
plug(Plug.Static, at: "/", from: :tilex, gzip: true, only: ~w(assets ...))
But why stop there? We can compress our dynamic document bodies just as easily.
In config/prod.exs, add compress: true to the http config of the endpoint.
config :my_app, MyAppWeb.Endpoint,
http: [port: {:system, "PORT"}, compress: true]
Tweet