Search code examples
javascriptcssapachewebhttp-status-code-403

403 Forbidden on site resources (js,png,css) but permissions are OK?


I have a strange problem with a website I am currently working on.

The server (apache2) gives me a 403 Forbidden error on some of my resources,notably the js and css files. I checked the permissions and they should be fine since I have put 777 to see if it was the permissions that were giving the error. Here's an example ll of one of the files that give the error.

-rwxrwxrwx 1 ftpuser webdevadmin 94083 Jun  5  2018 /home/ftpuser/site/BRG-LAB_Doubs/BRG-LAB_DOUBS_WEB/res/jquery.js*

And as you can see, the user running apache is the same as the owner of the file (ftpuser)

ftpuser  11408  0.0  0.1 1299340 10952 ?       Sl   06:25   0:07  \_ /usr/sbin/apache2 -k start

The website is at https://doubs.brg-lab.com/ Does anyone have an idea why the server refuses to serve the js and css files ?

Thanks


Solution

  • Looking at the site, I can see that the main page is coming from https://doubs.brg-lab.com/BRG-LAB_Doubs and the resources are coming from https://doubs.brg-lab.com/BRG_LAB_DOUBS_WEB/* (https://doubs.brg-lab.com/BRG_LAB_DOUBS_WEB/palette-MaterialIndigo_rwd.css?10000f07ce010, https://doubs.brg-lab.com/BRG_LAB_DOUBS_WEB/res/modernizr-2.5.3.js, https://doubs.brg-lab.com/BRG_LAB_DOUBS_WEB/res/cbao_40_85D333E9_.png, etc).

    Could it be that the access to /BRG-LAB_Doubs is ok, but to /BRG_LAB_DOUBS_WEB isn't?

    You say that the resources are in /home/ftpuser/site/BRG-LAB_Doubs/BRG-LAB_DOUBS_WEB/ , so BRG-LAB_DOUBS_WEB is a sub-folder of BRG-LAB_Doubs, but that's not how it appears to the browser - it's using /BRG_LAB_DOUBS_WEB. Are they actually the same, or are the files duplicated and one set doesn't have the right permissions set? I'm especially suspicious of the BRG- vs BRG_ folder names - that looks like a typo might have happened at some point..