minhajuddin
Gzip plug and plug contrib
Hi Guys,
I had to build a Gzip plug for one of my projects as I needed only a subset of pages to be Gzipped (PlugContrib.Gzip – plug_contrib v0.1.2). I’d love to hear any ideas to add to this plug_contrib package. Rack has a nice list of Middlewares listed at GitHub - rack/rack-contrib: Contributed Rack Middleware and Utilities · GitHub . Many of these are already present in Phoenix/Plug. I’d love to hear ideas on what people would like to have in this project. I’d love for this project to collect non core plugs which web apps may need from time to time ![]()
Most Liked
josevalim
Btw, Cowboy also supports gzipping. You only need to pass compress: true to the server configuration (on Phoenix this means under the :http/:https keys in your configuration):
config :my_app, MyApp.Endpoint,
http: [compress: true, ...],
https: [compress: true, ...]
The Plug can still be handy in many situations, for example, if you cannot compress all routes, the Plug gives you flexibility where the Cowboy configuration cannot.
josevalim
Plug.CSRFProtection uses a masked token which does not make it vulnerable to breach (although you need to be careful to not introduce something similar).
minhajuddin
Thanks, I did come across this. Like you said it compressed all the traffic. Our scenario required compression of just a subset of the routes ![]()
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #code-sync
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








