Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

403 error for js files in vendor directory on Heroku

My CakePHP v3.x app runs fine in my local Vagrant environment, but when I deploy to Heroku, I get 403 errors for all javascript files located in /webroot/vendor/...

CSS and javascript files outside that directory load fine.

https://example.com/js/i_load_fine.js
https://example.com/vendor/i_cause_403_error.js

/Procfile

web: vendor/bin/heroku-php-apache2

This question sounds similar, but I checked and .htaccess already has the recommended RewriteCond:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
like image 771
emersonthis Avatar asked Oct 22 '15 17:10

emersonthis


2 Answers

I wonder if "vendor" is a reserved word in Heroku?

yes, if you will be use "vendor" folder name, may be error 403 errors. Because root dir web server vendor/bin/ . Don't use public name "vendor" and "bin".

like image 155
Alex Sokolov Avatar answered Sep 22 '22 06:09

Alex Sokolov


For what it's worth, I just saw the same issue (had a "vendor" folder that kept getting 403 errors).

I renamed the vendor folder to "v" (and fixed references) and everything worked just fine.

I wonder if "vendor" is a reserved word in Heroku?

like image 33
CleverPatrick Avatar answered Sep 25 '22 06:09

CleverPatrick