HTTP 403 Forbidden Status Code and Fix Error – POFTUT

HTTP 403 Forbidden Status Code and Fix Error


HTTP protocol uses HTTP status codes in order to provide information about the requests. There are different types of status codes like 100, 200, 300, 400, etc. All of them have different meanings and subcodes like 403. In this tutorial, we will examine the 403 Forbidden Error Code .

Example Response

Here is some example response about HTTP 403 Forbidden. This code is compatible with all major browsers.

HTTP/1.1 403 Forbidden 
Date: Wed, 21 Oct 2015 07:28:00 GMT

AND other variations may like below.

403 Forbidden
HTTP 403
Forbidden: You don't have permission to access [directory] on this server
Forbidden
Error 403
HTTP Error 403.14 - Forbidden
Error 403 - Forbidden
HTTP Error 403 - Forbidden

403 Forbidden Meaning

Web servers are used to serve server resources in different ways. These resources are shared with a URI where it refers to the resource. In some cases, some resources may be not provided to the request. This is generally applied with resource restriction with 403 Forbidden . Or the access may require some authentication to the resource.

403 Code References According To Programming Languages and Framework

There are different programming languages and frameworks in order to serve the HTTP protocol. They generally provide some constant as easy to respond with HTTP 403 Forbidden code. Here are some of the popular them.

  • Ruby On Rails HTTP 403 Forbidden  :forbidden
  • Go HTTP 403 Forbidden http.StatusForbidden
  • Symfony HTTP 403 Forbidden Reponse::HTTP_FORBIDDEN
  • Python2 HTTP 403 Forbidden httplib.FORBIDDEN
  • Python3 HTTP 403 Forbidden http.client.FORBIDDEN
  • Python3.5+ HTTP 403 Forbidden http.HTTPStatus.FORBIDDEN

403 Forbidden Error Solution From Client Side

There are different ways to solve this error. We will learn generic ways to solve this. But as you know there are different web servers like Apache, IIS, Tomcat, Nginx, etc which provides a different mechanism to solve this problem.

  1. Check URL . We may try to access a URL that is incorrect or does not exist.
  2. Clear Browser Cache. HTTP protocol generally tries to look local cache to get resources faster. We need clear this cache which will get resources from remote servers without looking cache.
  3. Login or Authenticate Web Site . We may need to login to access given resources. We can use HTTP basic authentication or similar ways.
  4. Clear Browser Cookies . Cookies are generally used to provide login and session information. Old cookies may provide session related problems so clearing browser cookies will solve this issue.
LEARN MORE  TCP and UDP Port List, Names and Usage Frequency

403 Forbidden Error Solution From Server Side

If we are the owner of the web server we have to look several cases in order to solve this issue.

  1. Empty httpdocs directory while navigating to the given URL or directory there may need some resources to match and present.  If there is no folder we have to create is in the web server or httpdocs directory.
  2. No index page Index pages like index.html , index.asp or index.php is used to provide default content and resources. If they do not exist we should create them properly.
  3. Permission and ownership errors Web server process or daemon will home some rights to read, write , execute local file system. If they are not set properly we will get HTTP 403 Forbidden error. We can use the following permissions for Linux systems.
Folders and Directories: 755

Static Content and Regular Files: 644

Dynamic Content and Web Application Code: 700

For more information about permission look following chmod tutorial.

Linux Chmod Command Tutorial with Examples To Change Permission of Files and Folders

Leave a Comment