Don't track route not found errors

This commit is contained in:
Claudio Ortolina
2026-03-10 20:05:27 +00:00
parent fa535393e0
commit 20b497bbb8
3 changed files with 23 additions and 28 deletions
-27
View File
@@ -43,8 +43,6 @@ defmodule MusicLibraryWeb.Endpoint do
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :music_library
end
plug :reject_bot_scanners
plug Phoenix.LiveDashboard.RequestLogger,
param_key: "request_logger",
cookie_key: "request_logger"
@@ -61,29 +59,4 @@ defmodule MusicLibraryWeb.Endpoint do
plug Plug.Head
plug Plug.Session, @session_options
plug MusicLibraryWeb.Router
defp reject_bot_scanners(%{request_path: "/wp-" <> _} = conn, _opts),
do: conn |> send_resp(404, "") |> halt()
defp reject_bot_scanners(%{request_path: "/wordpress" <> _} = conn, _opts),
do: conn |> send_resp(404, "") |> halt()
@blocked_paths [
"/.env",
"/admin",
"/blog/wp-includes/wlwmanifest.xml",
"/files.php",
"/grsiuk.php",
"/jq.php",
"/style.php",
"/vgtyu.php",
"/vx.php",
"/xleet.php",
"/xmlrpc.php"
]
defp reject_bot_scanners(%{request_path: path} = conn, _opts) when path in @blocked_paths,
do: conn |> send_resp(404, "") |> halt()
defp reject_bot_scanners(conn, _opts), do: conn
end