Question
How to disable HTTP OPTIONS method in Nginx as a proxy in Plesk?
Answer
- Login to Plesk GUI
- Go to Domains > example.com > Apache & Nginx Settings > Additional Nginx directives > Apply following configuration:
add_header Allow "GET, POST, HEAD" always;
if ( $request_method !~ ^(GET|POST|HEAD)$ ) {
return 405;
} - Connect to the server via SSH and verify with following command that HTTP OPTIONS method is not allowed:
# curl -v -X OPTIONS http://example.com
<head><title>405 Not Allowed</title></head>
…
* Connection #0 to host example.com left intact
* Closing connection #0
In case it is required to apply this configuration to several domains, follow instructions provided in following KB article:Â How to update additional Nginx directives for several domains