HTTP 403 provides a distinct error case from HTTP 401; while HTTP 401 is returned when the client has not authenticated, and implies that a successful response may be returned following valid authentication, HTTP 403 is returned when the client is not permitted access to the resource despite providing authentication such as insufficient permissions of the authenticated account.1
Error 403: "The server understood the request, but is refusing to authorize it."2: §15.5.4
Error 401: "The 401 (Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource."3: §15.5.2
The Apache web server returns 403 Forbidden in response to requests for URL4 paths that corresponded to file system directories when directory listings have been disabled in the server and there is no Directory Index directive to specify an existing file to be returned to the browser. Some administrators configure the Mod proxy extension to Apache to block such requests and this will also return 403 Forbidden. Microsoft IIS responds in the same way when directory listings are denied in that server. In WebDAV, the 403 Forbidden response will be returned by the server if the client issued a PROPFIND request but did not also issue the required Depth header or issued a Depth header of infinity.5
A 403 status code can occur for the following reasons:6
Client request:7
Server response:8
See #Substatus error codes for IIS for possible reasons of why a webserver may refuse to fulfill a request. ↩
R. Fielding; M. Nottingham; J. Reschke, eds. (June 2022). HTTP Semantics. Internet Engineering Task Force. doi:10.17487/RFC9110. ISSN 2070-1721. STD 97. RFC 9110. Internet Standard 97. Obsoletes RFC 2818, 7230, 7231, 7232, 7233, 7235, 7538, 7615 and 7694. Updates RFC 3864. /wiki/Roy_Fielding ↩
"HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)". IETF. June 2007. Archived from the original on March 3, 2016. Retrieved January 12, 2016. https://web.archive.org/web/20160303200436/http://www.webdav.org/specs/rfc4918.html#rfc.section.9.1.1 ↩
HTTP status code 403 How do I solve the problem with the 403 status code? https://http-statuscode.com/en/code/4XX/403#item-9 ↩
Example of "Client request" and "Server response" for HTTP status code 403 https://http-statuscode.com/en/code/4XX/403#item-15 ↩