afomi
Plug_deflect - deflect invalid traffic
After doing this a 3rd time, I packaged a small library; a plug that deflects common sources of invalid traffic before it hits the router.
I’m curious how others are approaching this.
And, I’d appreciate feedback, here or as a GitHub issue. Thanks!
Most Liked
a3kov
Vulnerability scanners, bots, and scripts constantly probe web apps for WordPress, PHP, .env files, and other non-Elixir targets.
Phoenix routing is based on pattern matching, which is much faster than regular expressions. So unless you are doing some really heavy processing on all requests, reaching natural “no route” result should be very cheap.
PlugDeflect pattern-matches these requests and returns 404 immediately — no router, no controller, no wasted cycles.
You are wasting cycles because you are passing all traffic, including legitimate one through the regular expressions.
krasenyp
How I approach this? At the reverse proxy level, where it should be approached.
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








