403 Forbidden: what it means and how to fix it

A 403 Forbidden error means the server understood the request and decided not to fulfil it. Unlike a missing page, the address exists; unlike a 429, waiting will not help on its own. Something about the request, the visitor or the server's rules says no, and the fix depends on which end of the request you are.

Section Rate limiting Updated Status 403

Quick facts

Status code
403 Forbidden
Defined in
RFC 9110, section 15.5.4
Means
The server understood the request and refuses to fulfil it
Not the same as
401 (sign in first), 404 (not found), 429 (too many requests)
Common sources
File permissions, access rules, a web application firewall, address or country blocks

The meaning comes from the HTTP specification, RFC 9110: a server that wants to hide that a resource exists may answer 404 instead.

Where a refusal does come from a limit, the way requests are counted decides who meets it: rate limiting algorithms: four ways to count requests compares the common methods, and distributed rate limits covers what changes when the count is spread across several nodes.

What “403 Forbidden” and “access denied” mean

403 Forbidden is the server's way of saying it knows what you asked for and will not give it to you. Browsers and servers word it differently: Forbidden, Access Denied, You don't have permission to access this resource, or a branded page from the site's security provider. The status code is what they share.

Signing in does not always help. A 401 asks for credentials; a 403 says the credentials, the address or the request itself are not allowed, even if they are valid.

Why am I getting a 403 Forbidden?

Why am I getting a 403 Forbidden? Because something between your request and the page said no. Which layer said it decides the fix.

Where a 403 is set and what to check first
What you noticeWhere the refusal is setFirst check
One page refuses, the rest loadA permission or access rule on that pathReload the address, then ask the owner about that path
Everything refuses on one network or VPNThe source address is blockedTry another network and see whether the address is listed
It worked until you signed inThe account lacks the role the page needsSign in with the account that has access
A form refuses after you submit itA firewall rule matched what you sentPass the reference number on the error page to the owner
A script is refused, the browser is notA rule aimed at automated clientsRead the site's rules for scripts and ask the owner

A request refused only when you send many is a different code: see 429 error.

HTTP 403 status code: what the response says

The 403 meaning in one line: the server knows the address and refuses this request. It is a refusal, not a missing page. The HTTP 403 status code belongs to the client-error class, which RFC 9110 describes as cases where the client seems to have erred. For a 403 that wording is loose: the visitor may have done nothing wrong, and a rule on the server's side decided otherwise.

What an “access denied” webpage tells you

An “access denied” webpage is the visible half of a 403. The wording is chosen by whoever wrote the page. The HTTP error status, such as 403 Forbidden, is shown in the browser's network panel and is the part that identifies the refusal.

Write down three things for the owner: the time, the address you were on and any reference number printed on the page. A reference number suggests a filtering layer in front of the server, so the owner should search for it there. A plain page that names the web server comes from the server itself, and its error log is the place to look.

“You don't have permission to access this resource on this server”

Messages such as “Access denied. You don't have permission to access this resource on this server”, “Access to this resource on the server is denied” and a bare forbidden web page are different wordings of one 403. Whoever wrote the page chose the words, and none of them says why the request was refused. A 403 nginx page, an Apache Forbidden page and an IIS “Access is denied” are one status code 403 written by different software; only the log line names the cause.

Server wording: nginx, Apache and IIS

Default error pages differ by server, and a site can replace them with its own, so missing wording proves nothing.

Default error wording by web server
ServerWording on the pageWhere the owner looks
nginx403 Forbidden, then a line such as nginx/<version> (Ubuntu)The nginx error log
ApacheForbidden, then a line such as Apache/<version> (CentOS) Server at example.com Port 80The Apache error log
IIS7403 - Forbidden: Access is denied, or a numbered form such as HTTP Error 403.14 - ForbiddenThe IIS log for that request

The name, version and bracket (Ubuntu, CentOS) identify the software and system that wrote the page, not the reason for the refusal. The number after the dot in 403.14 is extra detail from the server; read the server's own documentation for what it means.

When a script gets the error

Python's urllib reports a refused request as urllib.error.HTTPError: HTTP Error 403: Forbidden. The library only passes on the answer; the refusal was decided by the server.

A site can refuse automated clients by rule, and that rule is the owner's choice. Do not disguise the client to get round it. Ask the owner, use the site's published interface if it has one, or ask for your address to be allowed.

“Expected response code 200, got 403”

A test or monitor that fails with “expected response code 200 got 403” is reporting a 403 Forbidden refusal: the request reached a server and the server said no. Status code 403 comes from the server, so changing the assertion fixes nothing. Ask what differs between the test's request and a visitor's: the source address, a missing token or key, a header, or a rule aimed at automated clients. If a firewall is the cause, the match is in its activity log. Give the monitor credentials or ask for its address to be allowed; do not disguise it as a browser.

“Request failed with status code 403”

Request failed with status code 403 is how axios, a JavaScript HTTP client, words a refused request; the status itself is in error.response.status. Clients word it differently, but the fact is the same: the client received status code 403 from the server and is only reporting it. The server or a filtering layer in front of it made the decision.

Before changing code, check what the request sent: the address, the token or key, and whether that account may call that path. A call that works from one network and fails from another points to the source address, as in the table above.

If you see a 403 as a visitor

To resolve a 403 Forbidden error as a visitor, rule out your own side first. How to get past a 403 Forbidden is not a trick: a block the owner set on purpose is theirs to lift. In order:

  1. Check the address. A mistyped path can point at a folder the server will not list.
  2. Reload, then clear cookies for the site. A stale session or a broken cookie can be refused.
  3. Try a private window or another browser. Safari, Chrome and Firefox all show the status the server sent; a different result points to a cookie, extension or cache on your side.
  4. Turn off a VPN or proxy. Shared addresses are sometimes blocked because of what other users of the same address did.
  5. Try another network. If it works on mobile data and not at the office, the block is on your network's address, not on you.
  6. Contact the site. Give the time, the page and any reference number on the error page: that is what lets the owner find the refusal in their logs.

If the page says your address is on a list, IP blacklist check explains how to see which list and why.

If your site returns 403: the usual causes

  • Permissions. The web server cannot read the file or directory, or directory listing is off and there is no index page.
  • Access rules. An allow or deny rule in the server or application configuration matches the request.
  • Authentication and roles. The user is signed in but lacks the role the page requires.
  • A web application firewall or bot filter. A rule matched something in the request; this is the case behind “blocked by WAF” and “website blocked by firewall”.
  • Address and country blocks. A blocklist, a reputation feed or a geographic rule refuses the source.

The fastest way to tell them apart is the log line for the refused request: which component wrote it, and which rule or reason it records.

A 403 problem that only some visitors see

A 403 problem, where the Forbidden or access denied page reaches some visitors and not others, points away from file permissions, which do not look at the visitor, and toward rules that look at who or where a request comes from: an address or country block, a bot rule, a role, or a firewall rule that matched one visitor's input. Ask two people for the time, address and path, one who is refused and one who is not, and compare the log lines for both requests.

Reading the server's error log

The error log usually names the cause in one line. In nginx, directory index of "/var/www/site/" is forbidden means a folder was requested and has no index file, and (13: Permission denied) means the server process cannot read the file. In Apache, AH01630: client denied by server configuration means an access rule refused the request. A Require all denied line in the Apache configuration or in an .htaccess file refuses every request to that location.

If the error log has no matching entry, the 403 was probably produced before the request reached the server: by a firewall, a filtering layer or a proxy in front of it. Look there next, starting with the time and address of the refused request, as described under activity log.

When a firewall blocked the request

A WAF in blocking mode refuses requests that match its rules, and many return 403 for that. When it refuses a real customer, the request usually looked like an attack in one detail: code in a support ticket, markup in a comment, an unusual header from an old client.

Find the matching entry in the firewall's log, confirm what matched, and fix it narrowly: an exception for that field or path, not switching the rule off everywhere. False positives covers how to find these requests, and exceptions how to keep each one narrow and dated.

A 403 from a WAF block

A 403 comes from a WAF block when the firewall is in block mode and a rule matched the request. The proof is an entry in the firewall's log for the same time, address and path.

Which mode could have produced the 403

What each mode does to a matching request
ModeWhat happens to a matching requestWhat a 403 then means
offNothing is inspectedNot this firewall; look at the origin or another layer
monitorThe match is recorded and the request is still servedNot this firewall's refusal; the match is only a log entry
blockThe request is refused and recordedCheck the log: a matching entry means the firewall refused it

No log entry for the refused request, plus a line in the web server's error log, puts the refusal at the origin.

Fix a WAF block without opening the door

  1. Collect the time, the address and the path from the person who was refused.
  2. Find the entry and read which rule matched and which part of the request it matched.
  3. Decide whether the request was legitimate. If it was an attack, leave it blocked.
  4. If it was legitimate, add an exception for that path or field only, with a review date.
  5. Repeat the request and check that it is served and that the log still records other matches.

When search engines get a 403

A 403 sent to a search engine crawler is read as a real answer, not as a temporary problem. Google's documentation says that pages answering with 4xx codes other than 429 are dropped from the index if they were indexed before, and that 401 and 403 must not be used to slow crawling down.

So a country block, an address block or a bot rule that catches a crawler can quietly remove pages from search. Check your search console for pages reported as forbidden after any new blocking rule, and use 429 with Retry-After if the aim is to slow a crawler rather than to refuse it.

403 and the other codes a block can return

Not every refusal is a 403. The code tells you what kind of refusal it is.

  • 401 Unauthorized. Credentials are missing or wrong; signing in may fix it.
  • 403 Forbidden. Understood and refused; the request, the user or the source is not allowed.
  • 404 Not Found. Sometimes used instead of 403 to hide that a resource exists.
  • 429 Too Many Requests. Refused for rate, not content; the same request will work later. See 429 Too Many Requests.
  • 503 Service Unavailable. The server cannot handle the request now, often under load; it says nothing about the visitor.

401 vs 403: Unauthorized or Forbidden

A page or log line that says “403 Unauthorized” mixes two names. The status code is 403, and its name is Forbidden. Unauthorized is the name of 401, which RFC 9110 defines as a request that lacks valid authentication credentials; a server answering 401 must also send a WWW-Authenticate header saying how to sign in. The practical question is whether the server does not know who you are, or knows and refuses.

401 Unauthorized and 403 Forbidden compared
401 Unauthorized403 Forbidden
What the server saysValid credentials are missingThe request is understood and refused
Credentials sentMissing, or bad auth that did not authenticateTreated as insufficient to grant access
Sign in againFixes it, with valid credentialsDoes not help with the same credentials; a different account or a changed rule might
HeaderWWW-Authenticate is requiredNot required

If you run the service, answer 401 when no valid credentials arrived and 403 when the caller is known but not permitted. A client that receives a 403 should not retry with the same credentials; the specification allows retrying with different ones.

Questions

What does 403 Forbidden mean?

403 Forbidden means the server understood the request and refuses to fulfil it. The resource exists, but the request, the user or the source is not allowed to reach it.

How do I fix a 403 Forbidden error?

As a visitor: check the address, clear the site's cookies, turn off a VPN or try another network, then contact the site. As an owner: find the log line for the refused request and fix the permission, access rule or firewall rule that matched.

Is 403 the same as access denied?

Yes, in practice. Access Denied is common wording for a 403 response; the status code is what identifies it.

What is the difference between 401 and 403?

401 means credentials are missing or invalid and signing in may help. 403 means the server understood who you are, or what you sent, and still refuses.

Why was my request blocked by a WAF?

Something in it matched a firewall rule, often text that looks like code or an unusual header. If the request was legitimate, the site owner can find it in the firewall's log and add a narrow exception.

Is 403 Unauthorized the same as 403 Forbidden?

In HTTP, 403 is named Forbidden and Unauthorized is the name of 401. A page that says “403 Unauthorized” is still a 403: the server understood the request and refuses it, and the same credentials will not change the answer. A 401 is the one that asks for valid credentials.

What does “Request failed with status code 403” mean?

It is the error message the axios JavaScript HTTP client gives when the server answers with status 403. The server refused the request; check the address, the credentials and the permissions, then the server or firewall log for that request.

Why does a page say I don't have permission to access this resource on this server?

Because the server, or a layer in front of it, answered with status code 403 Forbidden and the access denied page shows its wording. The words do not give the reason. Find the log entry for the request, or send the owner the time, the address and any reference number on the page.

What does “expected response code 200 got 403” mean?

A test or monitor expected a normal answer, 200, and received a 403 response code, a refusal. Status code 403 Forbidden means the request arrived and the server declined it. Compare the test's source address, credentials and headers with a visitor's request, then check the server or firewall log.