giorgio <george.peverell@...> writes:
>
> I get lots of stuff in my logs like:
> ActionController::UnknownHttpMethod (PROPFIND, accepted HTTP methods
> are get, head, put, post, delete, and options):
>
> I''d like to reject this stuff before it hits rails and clogs
passenger
> and then the error log.
>
> How can I make Apache reject some urls/requests before passing them on
> to Rails.
>
> I''m sure I can stick something in .htaccess with mod_rewrite or
> something but I dont want to do it by trail and error if there is a
> good recipe somewhere.
>
> It wont get all of them but I get hundreds of attempts at /
> manager.html and /phppgadmin and stuff like that that fills the rails
> log and obscures more valuable log entries.
>
> Cheers
> George
>
Sounds like a good job for a Rack filter. Something like:
config.middleware.use ''HttpVerbResponder'',
''PROPFIND'' => [404, {}, ''Not
supported''],
''PURGE'' => [404, {}, ''Not supported''],
''OPTIONS'' => [200,
{"Access-Control-Allow-Origin" => "*",
"Access-Control-
Max-Age" => ''1000''},''OK"]
class HttpVerbResponder
def initialize(app, options={})
@app = app
@options = options
end
def call(env, options={})
if response = @options[env[''REQUEST_METHOD'']]
response
else
@app.call(env)
end
end
end
From: http://grosser.it/2011/04/07/custom-response-for-weird-http-vers-like-
profind-purge-options-etc/
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.