HTTP 403 Forbidden Status Code

4xx Client Error · RFC 9110 §15.5.4 · Server understood request but refuses to authorize it

403 Forbidden RFC 9110 §15.5.4
Open /403/ →
Response & Header Builder
1m
max-age: 0s (immediate)
Editable Response Body
Live Raw HTTP Response 6 headers · 177 bytes
HTTP/1.1 403 Forbidden
Date: Tue, 24 Nov 2026 12:00:00 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 177
Cache-Control: no-store
Content-Type: application/problem+json; charset=utf-8
X-Content-Type-Options: nosniff

{"type":"https://bytehelpers.com/http-status/403/","title":"Forbidden","status":403,"detail":"Authenticated principal lacks the billing:write scope required for this endpoint."}
location /api/example {
    add_header Cache-Control "no-store" always;
    add_header X-Content-Type-Options "nosniff" always;
    default_type application/json;
    return 403 '{"type":"https://bytehelpers.com/http-status/403/","title":"Forbidden","status":403,"detail":"Authenticated principal lacks the billing:write scope required for this endpoint."}';
}
Pairwise HTTP Confusion Comparator
Open /http-status/401/ →
Attribute 403 Forbidden 401 Unauthorized
Status & Phrase403 Forbidden401 Unauthorized
Category4xx Client Error4xx Client Error
SpecificationRFC 9110 §15.5.4RFC 9110 §15.5.2
Core SemanticsIndicates that the server understood the request and may know the caller identity, but permanently refuses to authorize access to the target resource.Authentication is missing, expired, or invalid. Must include a WWW-Authenticate challenge header describing how to authenticate.
Cacheable by DefaultNoNo
Method PreservationN/AN/A
Safe to Auto-RetryNo (fix request first)No (fix request first)
Response Body AllowedYesYes
Key HeadersCache-Control, Content-TypeWWW-Authenticate, Cache-Control
HTTP 403 Forbidden Content-Length: 177 B Non-cacheable · Non-retryable
Ctrl+Enter: Copy Raw · 100% Browser-Local
Advertisement
Reserved fixed-height slot (CLS = 0.00) 728×90 320×100 300×50

Diagnosing HTTP 403 Forbidden Across APIs, WAFs, and Linux Web Servers

HTTP 403 Forbidden signals an authorization or policy denial rather than a missing login. In REST and GraphQL APIs, returning 403 tells the caller that their identity was verified (or irrelevant due to an IP/WAF rule) and re-sending the exact same credentials will not change the outcome. Always inspect which layer emitted the 403—response headers like Server: cloudflare, x-amzn-errortype, or nginx immediately pinpoint whether a CDN WAF, AWS IAM/S3 bucket policy, or your application middleware rejected the request.

On self-hosted Linux servers, 403 Forbidden is frequently a filesystem permission mismatch: Nginx worker processes (www-data or nginx) need execute (x) traversal bits on every parent directory (755 or 711) and read permission (644) on static assets. If a multi-tenant API wants to prevent attackers from enumerating valid resource IDs, RFC 9110 explicitly permits returning 404 Not Found in place of 403.

  • RFC SpecificationRFC 9110 §15.5.4 (Client Error 4xx)
  • Re-Authentication EffectRe-authenticating with the same account will NOT grant access
  • Cacheable / RetryableNot cacheable · Do not auto-retry
When should an API return 404 instead of 403 for unauthorized records?

If revealing that a resource ID exists is a security leak (such as multi-tenant invoices or private Git repositories), return 404 Not Found so unauthorized callers cannot enumerate valid IDs.

Why does Nginx return 403 Forbidden on a brand-new site directory?

Usually because either index.html is missing while autoindex is off, or a parent directory like /home/user lacks the execute bit (chmod 755/711) needed by the www-data user.

Can an unauthenticated request legitimately receive 403 Forbidden?

Yes. If access is forbidden regardless of credentials—such as a blocked IP range, failed WAF signature, or disabled feature—403 is completely valid even without authentication.