After deploying your application, if there’s an issue with file permissions or the workspace path, you may see the following or a similar error when you try to go to your application’s URL:

403 Forbidden
You don’t have permission to access this resource.

This error is usually caused by one of the following:

  • Incorrect file permissions.
  • Incorrect configuration within an .htaccess file.
  • Configuration error in the workspace path in Apache configuration.

If you cannot identify the issue, check the following, and if the issue persists, contact our Support team.

File Permissions

File permissions control who can:

  • Read: See the contents of a file or view files in a directory.
  • Write: Modify a file, or add or delete files in a directory.
  • Execute: Run a file and/or execute it as a script, or access a directory and perform functions and commands.

Each file and directory has its own set of file permissions, shown as a 3-digit number. Each number indicates the permission level for each category (read, write, and execute) shown above. We generally recommend the following permissions, but there could be cases where these need to be different for your application (e.g. some applications may need permissions on files to be set to 755 or 750):

  • Files: 644 or 640
  • Directories: 755 or 750

Make sure file permissions are set for your application. We recommend checking the documentation for your application, language, or framework if you are unsure.

.htaccess File

If your application’s code includes an .htaccess file, verify that any configuration directives in it are correct. For example, a misconfigured Rewrite or FilesMatch directive can cause a 403 error.

Workspace Path

If your application uses a buildpack and an Apache web server, an incorrect workspace path in your Apache configuration can cause a 403 error. The application logs may show an error similar to the following:

python: can't open file '/workspace/server.py': [Errno 2] No such file or directory

This error shows that the command the buildpack is trying to run doesn’t exist. Update your Apache configuration to use /workspace/web/ (instead of  /workspace/ or similar) to resolve this issue.

Related Documentation