Heroku上供应商目录中的js文件出现403错误 [英] 403 error for js files in vendor directory on Heroku
问题描述
我的CakePHP v3.x应用程序在我的本地Vagrant环境中运行良好,但是当我部署到Heroku时,我发现位于 / webroot / vendor /.../中的所有javascript文件有403个错误。 code>
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和JavaScript文件可以正常加载。
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
/Procfile
web: vendor/bin/heroku-php-apache2
这个问题听起来很相似,但我检查过.htaccess已经有推荐的RewriteCond:
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>
推荐答案
原来我必须指定文档根目录为Procfile中的第二个参数: web:vendor / bin / heroku-php-apache2 webroot /
Turns out that I had to specify the document root as a second parameter in the Procfile: web: vendor/bin/heroku-php-apache2 webroot/
这篇关于Heroku上供应商目录中的js文件出现403错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!