HTTP methods define which action a client asks the server to perform: retrieve a page, submit data, modify a resource, or delete it. For most WordPress sites, the primary methods are GET, HEAD, and POST. If the server accepts PUT, DELETE, CONNECT, TRACE, or other methods without a specific need, it increases the number of possible misconfiguration and attack scenarios.
Restricting methods does not replace WordPress updates, account protection, or WAF configuration. It is an additional layer for minimizing the attack surface. The key is not to block requests mechanically: the REST API, WooCommerce, Elementor forms, CORS preflight requests, and external integrations may use methods that are not obvious during normal site browsing.
Which HTTP Methods Does a WordPress Site Need?
GET is used to retrieve pages, posts, images, CSS, and JavaScript. HEAD returns headers without the response body and is required by some crawlers, monitoring systems, and availability-checking tools. POST is used to submit forms, authenticate users, publish comments, handle some REST API requests, and perform WooCommerce operations.
Other methods are not necessarily dangerous by themselves, but they are often unnecessary for a typical informational WordPress site. PUT is usually associated with fully updating a resource, PATCH with partially modifying one, and DELETE with removing one. CONNECT is intended to create tunnels and should not be available on a standard web server. TRACE can expose unnecessary data during diagnostics and is usually disabled separately.
The OPTIONS method requires particular attention. It is used to determine a resource’s capabilities and for browser CORS preflight requests. If the site communicates with an external frontend, payment system, or API on another domain, completely blocking OPTIONS may break the integration.
- The basic set for many sites is GET, HEAD, and POST.
- OPTIONS may be required for CORS and external APIs.
- Allow PUT, PATCH, and DELETE only when a specific service genuinely uses them.
- CONNECT and TRACE are generally unnecessary for a standard WordPress site.
What to Check Before Changing the Configuration
Before adding a rule to Nginx or Apache, identify the site’s actual operating scenarios. Check contact and login forms, checkout, payments, webhooks, the REST API, mobile clients, and synchronization with external systems. It is especially important to account for services that do not operate through standard browser-based page viewing.
Review the web server’s access logs for a representative operating period. Pay attention to methods other than GET, HEAD, and POST, as well as the URLs they access. A single log entry does not prove that a method is required: it may be a scan. Compare it with the integration documentation and repeat the relevant functional test.
Make changes only after backing up the configuration. On a production server, it is advisable to test the rule first in a staging environment or within a narrow location or directory. Do not edit the configuration blindly through a hosting control panel if you do not understand which virtual host or configuration level it will affect.
- Create a list of integrations, forms, APIs, and webhooks.
- Review access and error logs before making changes.
- Save the previous configuration and prepare a rollback plan.
- Determine whether the site operates behind a proxy or CDN: the request may be blocked at another layer.
How to Restrict Methods in Nginx
In Nginx, available methods can be restricted with the limit_except directive in the required location. In the simplest case, all methods except GET, HEAD, and POST will be denied. Rule placement matters: it must apply to the virtual host and path that actually handle the WordPress requests.
The example below is a basic model for a site that does not need OPTIONS, PUT, PATCH, or DELETE. Before using it, check whether OPTIONS is required for CORS. In some Nginx configurations, WordPress already has separate locations for static files, PHP, or the API, so the rule must be coordinated with the existing structure.
- Do not copy the rule into every location without checking first: this can create different behavior for pages, APIs, and static resources.
- After editing, check the configuration syntax with nginx -t.
- Apply the configuration only after the syntax check succeeds.
- If the site uses OPTIONS, add it to the allowed list only after testing the CORS scenario.
location / {
limit_except GET HEAD POST {
deny all;
}
}
Disabling TRACE Separately in Nginx
Denying TRACE through the allowed-method list already prevents it in the location shown above. However, TRACE should be tested separately, especially if requests pass through a proxy, load balancer, or another web server. It is important to test the site’s public address rather than only the local Nginx instance, because another infrastructure component may generate the response.
- Check which component responds to TRACE.
- Do not treat the absence of a configuration error as proof that the method is actually blocked.
- After making changes, repeat the test from the same network used by users or integrations.
How to Restrict Methods in Apache
Apache uses the LimitExcept directive to restrict methods. It is applied in the context corresponding to the required directory or virtual host. The variant below allows GET, HEAD, and POST and denies all other methods with the Require all denied rule.
Do not mix Apache 2.4 syntax with outdated access-control rules without checking the version and current configuration. If the site operates through .htaccess, the ability to use these directives depends on the permitted AllowOverride settings. When in doubt, it is safer to modify the virtual host configuration and test it in a staging environment.
- Place the rule at the level of the required VirtualHost or directory.
- After making changes, check the configuration before restarting Apache.
- Keep in mind that blocking OPTIONS can interfere with CORS preflight requests.
- If a separate API requires DELETE or PUT, restrict it specifically instead of enabling the method for the entire site.
<Directory "/var/www/html">
<LimitExcept GET HEAD POST>
Require all denied
</LimitExcept>
</Directory>
TraceEnable Off
Why TRACE Is Disabled with a Separate Directive
TraceEnable Off explicitly disables TRACE at the Apache level and makes the configuration intent clear to administrators. This is useful even when LimitExcept already blocks the method in a particular directory. Make sure that no other server in front of Apache still accepts TRACE.
- Check the result on the public domain.
- Review the logs after the change to identify incorrectly blocked requests.
- Do not use TRACE as a standard diagnostic tool on a production site.
Testing with curl After Configuration
After applying the rules, test both allowed and denied methods. curl is convenient for this purpose: it displays the HTTP status and allows you to send a specific method without a browser. Run the tests before and after the change so that you can compare the behavior.
The expected status for a denied method depends on the configuration and the layer at which the blocking occurs. It may be 403 or 405. The number itself is less important than ensuring that the server does not perform the unwanted operation while legitimate requests continue to work.
- GET should return the normal page response.
- HEAD should return headers without the complete response body.
- Test POST using a real form or a test endpoint.
- Test OPTIONS if CORS or an external integration is involved.
- PUT, DELETE, and TRACE should be rejected when they are not required.
curl -i -X GET https://example.com/
curl -i -X HEAD https://example.com/
curl -i -X POST https://example.com/
curl -i -X OPTIONS https://example.com/
curl -i -X PUT https://example.com/
curl -i -X DELETE https://example.com/
curl -i -X TRACE https://example.com/
Functional WordPress Testing
Testing an HTTP method does not replace testing the business scenario. Submit a test form, open the login flow, place a test order, check the REST API, and wait for a test webhook. If the request passes through a CDN or load balancer, review the logs at each layer.
After release, review error logs and user reports. Typical signs of an overly strict rule include an unsent form, a payment error, a failed CORS request, missing synchronization, or a 403 or 405 status in the browser console.
- Test Elementor Forms and other forms that submit POST requests.
- Test the REST API if it is used by a mobile client or external system.
- Test WooCommerce webhooks and payment callback requests.
- Record the endpoint and method that must be allowed before loosening the rule.
Common Mistakes and a Secure Access Model
The most common mistake is allowing or denying methods without analyzing the specific site. A rule that works well for a static blog may break a store or a headless integration. Another problem is applying restrictions to only one location when some requests are handled by a separate proxy or server block.
Do not try to solve the problem with one global exception for the entire domain. If DELETE is required by a specific API, it is safer to allow it only on the relevant path and additionally protect the endpoint with authentication, permission checks, and logging.
Remember that method restrictions do not protect against malicious POST requests. They only reduce the number of unnecessary operations. Separate measures are still required, including updates to the core, themes, and plugins; protection of administrative accounts; correct access permissions; HTTPS; backups; and monitoring.
- Start with the minimum set of methods that is actually required.
- Add exceptions selectively instead of enabling all methods globally.
- Check the configuration after every change.
- Keep logs and the results of functional tests.
- Have a rollback ready in case an integration stops working after release.
Frequently asked questions
Is allowing only GET, HEAD, and POST enough?
For many standard WordPress sites, it is enough, but there is no universal rule. OPTIONS may be required for CORS, while a REST API, store, or external integration may use DELETE, PUT, or another method. Check the logs and service documentation first.
Should OPTIONS be blocked?
Not always. OPTIONS is used for CORS preflight requests and to check an endpoint’s capabilities. If the site accepts requests from another domain or has an external frontend, blocking OPTIONS may break the integration. In that case, restrict it carefully or allow it only where necessary.
What status should be returned for a denied HTTP method?
It is most commonly 403 Forbidden or 405 Method Not Allowed, depending on the server and the rule. Either can be normal if the method is not executed. Also check the logs and confirm that there are no side effects.
Can restrictions be configured only through a WordPress plugin?
In most cases, it is better to restrict methods at the web server or proxy level, before WordPress runs. A plugin can supplement the protection, but it does not always intercept every request and does not replace correct Nginx or Apache configuration.
Conclusion
For a typical WordPress site, restricting HTTP methods is a straightforward way to reduce the number of unnecessary interaction points with the web server. The basic approach is to allow only the required methods, disable TRACE separately, and configure targeted exceptions for APIs and integrations.
A secure configuration always ends with testing: check responses with curl, Elementor forms, the REST API, WooCommerce, payments, and webhooks. If a rule blocks a legitimate scenario, do not disable the protection completely—identify the specific endpoint and allow only the required method in the appropriate place.