403

Forbidden

The server understood the request but refuses to authorize it.

Quick Definition

The server understood the request but refuses to authorize it. Unlike 401 Unauthorized, authenticating will not help - the server has decided the client does not have permission to access the resource. The server knows who you are, but you're not allowed in. Re-sending the request with different credentials won't change the outcome unless those credentials have higher privilege levels.

When It Occurs

A 403 Forbidden error appears when the server's access control system explicitly denies access to the requested resource. This can happen at multiple levels: the operating system file permissions, the web server configuration, the application's authorization logic, or a firewall/WAF layer.

Common scenarios include trying to access admin-only pages as a regular user, visiting a website from a blocked country, trying to list a directory without an index file, or having your IP flagged by security software.

Common Causes

  • Insufficient user permissions/role - Your account doesn't have the required role (e.g., trying to access admin routes as a regular user)
  • IP address blocked - Your IP has been blacklisted by the server's firewall or security rules
  • Geographic restriction (geo-blocking) - The content is restricted to certain countries or regions
  • Directory listing disabled - Trying to browse a directory that has no index file and listing is turned off
  • .htaccess deny rules - Apache configuration explicitly denies access to certain paths or files
  • File permissions too restrictive - File permissions set to 000 or 600 prevent the web server from reading the file
  • WAF blocking request - Web Application Firewall flagged the request as suspicious or malicious
  • Hotlink protection - Trying to embed images/files from a domain that blocks external referrers
  • Missing index file in directory - No index.html/index.php exists and directory browsing is disabled

Platform-Specific Notes:

Nginx Returns 403 when autoindex is off and no index file exists, or when file permissions block the nginx user. Check error.log for "Permission denied".

Apache Triggers 403 via Require all denied in .htaccess, or when Options -Indexes blocks directory listing.

Cloudflare Returns 403 when WAF rules, IP Access Rules, or Zone Lockdown block the request. Check Cloudflare Firewall Events.

Node.js Express authorization middleware returns 403 when role-based access control (RBAC) denies access to the route.

🛠 How to Fix

  1. Check user role and permissions - Verify the authenticated user has the required role or permission for the resource
  2. Verify file/folder permissions (chmod) - Set directories to 755 and files to 644; ensure the web server user can read them
  3. Review .htaccess rules - Look for Deny from all or Require all denied directives blocking access
  4. Check IP blocking/whitelisting - Verify your IP isn't on a blocklist in the firewall or server configuration
  5. Verify directory index exists - Ensure an index.html or index.php file exists in the directory, or enable autoindex
  6. Review WAF rules - Check your WAF (Cloudflare, ModSecurity, etc.) for false positive blocks and create exceptions
  7. Check geo-blocking settings - If using country-level restrictions, verify the expected countries are whitelisted

💻 HTTP Example

# Request to a restricted admin endpoint
GET /admin/dashboard HTTP/1.1
Host: example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
# User role: "viewer" (requires "admin")

# Server Response
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
  "error": "Forbidden",
  "message": "You do not have permission to access this resource",
  "required_role": "admin",
  "your_role": "viewer",
  "statusCode": 403
}

Frequently Asked Questions

Why does 403 happen when I have the right password? +
A 403 Forbidden error is about permissions and authorization, not authentication. Even if your password is correct and you are successfully logged in, the server has determined that your account does not have the necessary permissions to access the requested resource. This is common when trying to access admin pages with a regular user account, or when server-level rules (like .htaccess, file permissions, or WAF rules) block access regardless of who you are.
Can a VPN cause a 403 Forbidden error? +
Yes, using a VPN can cause 403 Forbidden errors. Many servers block known VPN IP ranges, data center IPs, or specific geographic regions. If your VPN routes your traffic through a blocked IP address or a restricted country, the server's firewall or geo-blocking rules will deny access with a 403 error. Try disconnecting your VPN or switching to a different server location to resolve the issue.

Monitor Your Endpoints

Detect 403 errors on your pages instantly. Monitor access issues and get alerted before they impact your users.

Start Free Monitoring