[Django]-Can apache be configured to ignore OPTIONS requests?

2👍

The rewrite option is good, the ‘Apache Way’ is probably more like:

<LimitExcept GET POST>
deny from all
</LimitExcept>

or…

<Limit OPTIONS>
deny from all
</Limit>
👤Xealot

2👍

I found a solution used by a different framework and ported to Django. I place this at the top of any view that generate HTML with links to .XLS or .DOC files:

if request.method == 'OPTIONS':
    response = HttpResponse()
    response['Allow'] = 'GET, HEAD, POST'
    return response

I like Apache solution better though… assuming it doesn’t cause problems on the Windows side of things.

1👍

How about:

RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^OPTION
RewriteRule .* - [F]

(With mod_rewrite enabled.)

Leave a comment