HTTP status code lookup

403 Forbidden: Meaning, Causes and How to Fix It

A 403 Forbidden response means the server understood the request but refuses to carry it out. Unlike 401, logging in again usually won't help: the server already knows who you are, or doesn't care, and still says no.

403

Forbidden

The server understood the request but refuses to allow it. Logging in again won't help.

Look up any other status code →

Common causes

  • Your account doesn't have permission for this resource, such as a non-admin calling an admin endpoint.
  • File permissions on the server stop the web server from reading the file.
  • There is no index file in a folder and directory listing is turned off.
  • A firewall, WAF or bot protection, such as Cloudflare, blocked the request because of the IP address, the country or the request looking automated.
  • A CSRF check failed, so a form or API call was rejected.
  • An S3 bucket or object isn't public, or the bucket policy doesn't allow the request.

Fixing a 403 in nginx or Apache

Also check for deny rules in the server config or in a .htaccess file, and on SELinux systems, the security context of the files.

# nginx error log messages and what they mean
# directory index of "/var/www/site/" is forbidden
#   → add an index.html, or check the index directive
# open() "/var/www/site/index.html" failed (13: Permission denied)
#   → let the web server user read the files:
sudo chown -R www-data:www-data /var/www/site
sudo find /var/www/site -type d -exec chmod 755 {} \;
sudo find /var/www/site -type f -exec chmod 644 {} \;

Fixing a 403 from an API

  • Check the scopes or roles on your API key or token. A token can be valid (no 401) but not include the permission this endpoint needs.
  • Make sure you're calling the right account, project or organization.
  • Read the response body; most APIs say which permission is missing.

S3 and CloudFront

S3 returns 403 Access Denied, not 404, for a missing object when the caller isn't allowed to list the bucket. So a 403 from S3 can also mean the key is wrong. Check the object key, the bucket policy, Block Public Access settings and, behind CloudFront, the origin access control.

Frequently asked questions

What is the difference between 401 and 403?

401 Unauthorized means you aren't authenticated, so sending valid credentials could work. 403 Forbidden means you're not allowed even with the credentials you sent.

Why does a site give me 403 but works for others?

You may be blocked by IP address, country, a VPN, or bot protection. Try without a VPN, from another network, or contact the site's owners.

Should an API return 403 or 404 for a resource the user can't see?

Returning 404 hides whether the resource exists, which is safer for private data. Return 403 when it's fine for the user to know that the resource exists.

More http status code lookup guides

Open the full http status code lookup →