Troubleshooting guide
403 Forbidden: what it means and how to fix it
A 403 means the server understood who is asking, or decided it does not matter, and refuses anyway. The cause is a rule somewhere on the path: file permissions, a firewall, a bot filter or a permission check.
4 min read10 sectionsUpdated
On this page
Key points
- 403 = refused. Unlike 401, logging in again usually does not help.
- Web servers return 403 for unreadable files and for directories without an index file.
- WAFs and bot protection return 403 to clients they classify as automated, including monitoring tools.
- APIs return 403 when the key or token lacks the required permission or scope.
403 vs 401
401 Unauthorized means "who are you?": no credentials, or invalid ones. 403 Forbidden means "I know, and the answer is no": the credentials are fine but not allowed to do this, or the server refuses for another reason such as a firewall rule. Some servers return 404 instead of 403 on purpose, to avoid revealing that a resource exists.
# can the web server user read the file and enter every directory on the path?
namei -l /var/www/example.com/index.html
# nginx usually runs as www-data or nginx
ps -o user= -C nginx | sort -u
# fix ownership and permissions (adjust to your setup)
sudo chown -R www-data:www-data /var/www/example.com
sudo find /var/www/example.com -type d -exec chmod 755 {} \;
sudo find /var/www/example.com -type f -exec chmod 644 {} \;| Cause | Sign | Fix |
|---|---|---|
| File not readable by the server user | "permission denied" in the error log | Fix ownership and permissions on the file and every parent directory |
| Directory without an index file | "directory index of ... is forbidden" | Add index.html, or set the index directive; do not enable directory listing |
| Deny rules | A deny/allow block or .htaccess rule matches | Remove or narrow the rule |
| SELinux or AppArmor | Permissions look right but access fails | Check audit logs and set the right security context |
At a CDN, WAF or bot filter
Firewalls and bot protection return 403 when a request matches a rule: a country block, an IP reputation list, a rate rule, or a bot score. Two common surprises:
- Your own monitoring gets blocked. Uptime checks and synthetic tests are automated by nature. Allow their source addresses or user agent, or add a rule that skips bot checks for a health URL.
- Search engine crawlers get blocked by an aggressive rule. Check the firewall's event log for blocked crawler requests; verified crawlers should be allowed.
In an API or cloud storage
- Missing permission or scope: the token is valid but lacks the role or scope. The response body often names it.
- Expired or tampered signed URLs for object storage return 403.
- Bucket or object policies that do not allow public or cross-account reads.
- IP allowlists on the API key or the account.
Catch it automatically
A 403 on a page that should be public is an outage for those visitors even though the server is up. Point an uptime check at the important public URLs and alert on any status other than 200, and keep the check's source addresses allowed in your firewall so a new rule does not silence it.
Is 403 a server problem or my problem?
It is a 4xx code: the server refuses this request. As a visitor you can try logging in with an account that has access, disabling a VPN, or contacting the site; the fix is usually on the server side.
Why do I get 403 only from a script or tool?
Bot protection often blocks requests without a normal browser fingerprint, or from data center addresses. Use an allowed user agent or address, or ask the site owner to allow your tool.
Should a missing page return 403?
No. Missing pages should return 404. Use 403 for content that exists but is not allowed for this caller.
Check it now, free
- Website down checker: Is it down for everyone or just me? Check any site now.
Related reading
- 400 Bad Request: what it means and how to fix it: Fix a 400 Bad Request error: oversized cookies, malformed URLs, invalid JSON bodies and proxy rules, with commands to find which layer rejected it.
- 499 Client Closed Request in Nginx: what it means: What Nginx 499 Client Closed Request means: impatient clients, load balancer timeouts and slow backends, and how to tell a harmless 499 from a real outage.
- 422 Unprocessable Entity: how to fix it: Fix 422 Unprocessable Entity (Unprocessable Content): validation errors in APIs and forms, CSRF tokens in Rails and Laravel, and how to read the error body.
- 501 Not Implemented: how to fix it: Fix 501 Not Implemented: unsupported HTTP methods, servers and proxies that do not support PATCH or WebDAV, and how it differs from 405 and 500.
- 502 Bad Gateway: causes and how to fix it: What a 502 Bad Gateway means, the common causes behind Nginx, load balancers and CDNs, how to find yours and how to stop it happening again.
- Cloudflare error 1020: Access denied: Fix Cloudflare error 1020 Access denied: find the firewall rule that blocked a visitor using the Ray ID, tune WAF rules and allow your monitors and APIs.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.