Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent unwanted routes in nginx being routed to my rails app

How to prevent unwanted routes in nginx, for requests routed to my rails application.

Started GET "/w00tw00t.at.blackhats.romanian.anti-sec:)" for 125.218.121.25 at 2014-01-13 02:04:28 +0000
Processing by RoutingErrorsController#routing_error as
  Parameters: {"path"=>"w00tw00t.at.blackhats.romanian"}
Completed   in 0.8ms
like image 646
Rpj Avatar asked Nov 29 '25 20:11

Rpj


1 Answers

Use the location directive:

location ~ /myUnavailableRoute {
    deny all;
}

You can use regular expressions to block all routes matching a certain pattern (or to white-list only allowed routes if that makes more sense). There are some good examples in the nginx docs: http://nginx.org/en/docs/beginners_guide.html

like image 186
mcbex Avatar answered Dec 02 '25 09:12

mcbex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!