Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Malware / Trojaner / VirenKernelFlirt(01.10.2026 um 06:47 Uhr)
•
IT Security NachrichtenApp-arently it's legit.(01.10.2026 um 07:00 Uhr)
•
IT Security NachrichtenAnthropic’s Court Battles.(01.10.2026 um 07:00 Uhr)
••••••••
Malware / Trojaner / VirenKernelFlirt(01.10.2026 um 06:47 Uhr)
•
IT Security NachrichtenApp-arently it's legit.(01.10.2026 um 07:00 Uhr)
•
IT Security NachrichtenAnthropic’s Court Battles.(01.10.2026 um 07:00 Uhr)
••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Custom `RoutingError` handling in Rails

Today I was working on improvements to our Rails app monitoring, specifically, we wanted to get some data on what paths without underlying controller bots are…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

Today I was working on improvements to our Rails app monitoring, specifically, we wanted to get some data on what paths without underlying controller bots are making requests to.



As you know, attempting to navigate to some random path raises an ActionController::RoutingError which is then rescued and turned into a 404 response for users. So, where do we hook into for custom logging?



The answer is a special configuration option exceptions_app.




# in config/application.rb
config.exceptions_app = ->(env) do
exception = env["action_dispatch.exception"]

if exception.is_a?(ActionController::RoutingError)
ErrorsController.action(:route_not_found).call(env)
else
# fall back to Rails' default for all other errs
ActionDispatch::PublicExceptions.new(Rails.public_path).call(env)
end
end






Now you can TDD a regular controller action to handle any custom behaviors such as logging or a custom error page as needed.



A little note, be sure to access request.original_fullpath, rather than request.fullpath, because Rails internals will have set the fullpath to /404.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Custom `RoutingError` handling in Rails

Thematisch verwandte Begriffe: Custom, RoutingError, handling, Rails · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag