403 Forbidden
The server understood the request but refuses to allow it. Logging in again will not help unless your account gets access.
What 403 Forbidden means
403 means the server knows what you want and will not do it. Unlike 401, sending the same credentials again will not change the answer, though a different account or role might.
A 403 can come from the app, the web server, or a security layer such as a WAF or CDN in front of it. Servers may return 404 instead when they want to hide that a resource exists.
Common causes
- File or folder permissions the web server cannot read, or a directory with no index file and listing turned off.
- A web application firewall, CDN rule or bot filter blocking your IP, country or user agent.
- Your account or API token lacks the role or scope for this action.
- Hotlink protection, or a missing CSRF token on a form submission.
How to fix 403 Forbidden
- As a visitor, check you are logged into the right account, try another network or turn off your VPN, and clear cookies.
- On the server, check file ownership and permissions (commonly 644 for files and 755 for folders) and that an index file exists.
- Review WAF, CDN and .htaccess rules, and look for the blocked request in their logs.
- For APIs, confirm the token's scopes and the user's permissions.
Example response
HTTP/1.1 403 Forbidden
Content-Type: text/plain; charset=utf-8
403 ForbiddenHow to check for a 403 response
cURL
# Print only the status code
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/JavaScript (Node.js)
const res = await fetch("https://example.com/");
if (res.status === 403) {
console.log(res.status, res.statusText);
}Python
import requests
res = requests.get("https://example.com/")
if res.status_code == 403:
print(res.status_code, res.reason)Go
res, err := http.Get("https://example.com/")
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode == 403 {
fmt.Println(res.Status)
}Specification
403 Forbidden is defined in RFC 9110, section 15.5.4.
Related status codes
- 401
The request needs authentication. You are not logged in, or the credentials or token you sent are missing, invalid or expired.
- 404
The server cannot find anything at this URL. The page may have moved or been deleted, or the link may have a typo.
- 451
The server cannot show this resource because of a legal demand, such as a court order, government block or copyright claim.