A Security Rule Can Block Your Own Plugin: Reading a 401 or 403

Host My Blog graphic with the title "A Security Rule Can Block Your Own Plugin: Reading a 401 or 403"

A plugin screen says “REST API reachable (loopback): HTTP 401”. Or a scheduled task fails with a 403, while the same page opens in your browser without a problem. The easy conclusion is that the plugin is broken. Often it is not. Something in front of it refused the request, and the plugin only reported what it was told.

The short answer is that a 401 or a 403 tells you a request was refused, not who refused it. This post shows how to read the two codes, how to tell a WordPress refusal from a firewall or CDN refusal with one command, and what to change without switching your protection off. We read the Google, MDN and WordPress pages below on 28 November 2026. The cases come from our own support work and are anonymised, and in most of them we could see only from outside.

What a 401 and a 403 mean

MDN describes a 401 as a response that “indicates that a request was not successful because it lacks valid authentication credentials for the requested resource”. It describes a 403 as a response that “indicates that the server understood the request but refused to process it”. For a 403, MDN adds that authenticating or re-authenticating makes no difference.

CodePlain meaningWho often sends itFirst question to ask
401You are not logged in, or your credentials were not acceptedWordPress itself, a password-protected staging setting, or a rule that requires a loginShould this request have been logged in?
403The request was understood and refusedA firewall, a CDN rule, a security plugin or the hostIs a rule treating this request as a bot?

These are the usual senders, not a rule. A firewall can send a 401, and WordPress can send a 403. That is why the code alone does not settle the question, and why the body of the response matters more.

Why your own site can refuse your own plugin

Many plugins test themselves by asking your site a question over the web, a request from the server to its own address. That request travels the same road as a stranger’s request, so every rule in front of the site sees it. A rule that blocks unknown automated traffic does not know the request is friendly.

WordPress also has a say. Its REST API handbook says “You should not disable the REST API; doing so will break WordPress Admin functionality that depends on the API being active”. It then adds “However, you may use a filter to require that API consumers be authenticated, which effectively prevents anonymous external access.” A site, a security plugin or a host can use that route, and a plugin that expects open access then gets a 401.

You can see a genuine WordPress refusal yourself. We asked our own site for the current user without logging in, and it answered with a 401 and a short JSON body. The next section shows the command.

Tell the two sources apart with one command

Repeat the request the way the plugin does, with an ordinary browser user agent, and read the status, the content type and the start of the body. Replace the address with your own.

# Status and content type of the REST root
curl -s -o /dev/null -w "%{http_code} %{content_type}\n" -A "Mozilla/5.0" https://example.com/wp-json/

# A refusal you can read: the same address, with its body
curl -s -i -A "Mozilla/5.0" https://example.com/wp-json/wp/v2/users/me

On our own site on 28 November 2026 the first command printed 200 application/json; charset=UTF-8. The second returned a 401 with the content type application/json and this body:

{"code":"rest_not_logged_in","message":"You are not currently logged in.","data":{"status":401}}

That is WordPress refusing an anonymous request on purpose, with a readable code. A refusal from a firewall or CDN usually looks different. Use the table as a guide, and expect exceptions.

A diagram of a request from a plugin to its own site passing a firewall or CDN, then WordPress, then a plugin that restricts the REST API. An HTML or challenge page points to a rule in front of the site, and JSON with a code field points to WordPress or a plugin. It is a diagram of this post, not Host My Blog data.
What you seeIt points toWhat to do next
JSON with a “code” such as rest_not_logged_inWordPress or a plugin, which understood the request and said noCheck whether the route should need a login, and check any plugin that restricts the REST API
An HTML page, a challenge or a short “access denied” pageA rule in front of WordPress, such as a firewall, a CDN or the hostFind the rule, then allow this one route or address
The same refusal for the home page, the login page and the REST addressA rule that covers the whole site for this kind of requestAsk the host or the firewall owner which rule fired
Only one route refusesA rule that matches a pattern in that addressCompare the address with the rule’s pattern

What we have seen, and what we could not confirm

These are real cases from our support work, with names removed. Treat them as symptoms, not as a diagnosis.

  • A plugin’s diagnostics screen on a site behind a CDN and a firewall reported “REST API reachable (loopback): HTTP 401”. Our check from outside got a 403 block page for the home page, the REST address and the plugin’s own address. We could not see inside the site, so we did not confirm the cause. The plugin’s own advice was to save Permalinks once and, on Nginx, to add a bypass snippet.
  • A site returned 403 to automated requests for the home page, the login page and the REST address, while it worked in a browser. Later an AI readiness report on the same site showed an AI crawler and page fetches getting 403. We never investigated the cause.
  • A CDN firewall rule blocked any request whose address contained a particular file name in the query string, so the host’s file manager could not open that file. Rules match patterns, not intent.
  • One site showed a browser check page to every automated request, so scripts could not read its pages at all.

One more case is our own mistake. To test a site we once pretended to be a search engine crawler, and the host firewalled our address. Since then we send a few slow requests with an ordinary browser user agent, and nothing more.

When the blocked visitor is a search engine

The same rules can refuse crawlers you want. Google’s Search Central blog explained this on 11 November 2026: “When a CDN or Web Application Firewall (WAF) flags automated requests and intercepts them with a challenge like CAPTCHA, Google’s crawlers fail the test.” Its advice is “If you need to block bots, allow verified bots in your CDN and firewall settings.” The post names Google’s published IP ranges as the way to identify its crawlers.

Google’s page on HTTP status codes gives a second warning, dated 4 February 2026: “Don’t use 401 and 403 status codes for limiting the crawl rate.” If you want to slow a crawler down, a refusal with the wrong code is not the tool. We cover the layers that can overrule a robots.txt file in Why Your robots.txt Allow Rule Does Not Work.

A six step order for fixing it

  1. Reproduce it the way the plugin does. Use the commands above, with a browser user agent, and keep the status and the body.
  2. Check the REST root. If other addresses fail too, the block covers the whole site. If only one fails, look for a pattern.
  3. List what sits in front of WordPress. A firewall, a CDN, a security plugin, or a password on a staging copy. Any of them can be the refusing rule.
  4. Save Permalinks once. It rewrites the rules and does no harm. It fixes a broken rewrite, and it will not fix a firewall rule.
  5. Allow one route, not everything. Add an exception for the plugin’s route or for your server’s own address in the firewall, then test again.
  6. Run the plugin’s diagnostics again and compare with your first result.

Steps 3 and 5 need access to the firewall or the host, which we do not have on a site that is not ours, so we never ask for logins. Do not switch protection off to test. It also removes the rule you are trying to find, and it leaves the site exposed while you look.

What we do not know

We cannot say which rule is refusing your request, because that depends on settings we have not seen. We saw most of our cases only from outside, so their causes stayed unconfirmed. We have not tested the setting names of any one firewall or CDN, so this post gives none. Some hosts and plugins block the REST API for visitors who are not logged in, and we do not know how often that is the cause. Google’s pages and the WordPress handbook can change, so re-read them before you set a rule.

Where Host My Blog fits

Host My Blog looks after WordPress blogs, and a 401 or a 403 that a plugin reports has reached our support inbox more than once. Our first move is always the same: reproduce the request from outside, read the body, and write down whether the refusal comes from WordPress or from something in front of it. That order stops us from changing a plugin that was never at fault.

Questions people ask

Why does my plugin get a 403?

A 403 means the server understood the request and refused it. For a plugin that calls its own site, a firewall, a CDN rule, a security plugin or the host is a likely source. Read the body of the response before you blame the plugin.

What is the difference between a 401 and a 403?

A 401 says the request lacks valid credentials. A 403 says the request was refused, and MDN notes that logging in again makes no difference. Neither tells you who sent the refusal.

Will saving Permalinks fix a 401 or a 403?

Only if the cause is a broken rewrite rule. It is harmless and quick, so try it once. It will not change a firewall rule.

Should you switch the firewall off to test a plugin?

No. Allow the one route or address the plugin needs, and test again. That keeps the rest of your protection in place and shows you which rule was in the way.

When a plugin on your site last reported a refusal, did you read the body of the response before you changed anything?

Share
Aditya Sharma
Aditya Sharma

Aditya runs Host My Blog and writes The Cited. Five years in WordPress, most of it spent on what actually makes a blog get found rather than what is supposed to. His attention now goes to how AI answers are changing that, and what a blog has to do to still be the source people land on. Everything he writes about here gets tested on the blogs Host My Blog looks after before it reaches the page.

More in WordPress

No comments yet

Be the first to comment.

Write a comment

Leave a comment