How to fix : A bad HTTP response code (403) was received - Forbidden / Cant Register Service Worker

By Mod     Tech


Most web developers face this  server issue.

It is mostly encountered when implementing a RESTful API on your website. Then you notice something is not working. 

What to do!!!!

You check your console log.

Boom! An error in red dangerous background has appeared. You get that WTF face.

 

But dont worry, today i will show you a very easy way of debugging this error

 

Causes of the 403 Forbidden error

 

mainly caused by unzipping downloaded Rest API files to your server

  • No File Permission on Server files,
  • Wrong File Permission on Server files
  • No folder Permission on Server files
  • Wrong folder Permission on Server files
  • Incorrect .htaccess file configuration

And many other reasons, but these ones are most common.

 

Simple Fixes to the 403 Forbidden error

  • Change your file permissions from whatever they are (probably empty or 0640) to 0644
  • Change your folder permissions to 0777 or 0755. Read on these permissions properties for more information..
  • If the first 2 does not work, then you probably have a misconfiguration in your .htaccess file, take a very close look at your file and edit errors. Try removing starnge rules in your htaccess and see if your error disappears. If the error doesnt go away, put back the removed code, to avoid more errors.

 

Happy development from Me to you.

 

 


Share this article!