8

I have push my simple php app to Heroku and get 403 status for some js files.

https://guarded-forest-7267.herokuapp.com/vendor/jquery/dist/jquery.min.js Failed to load resource: the server responded with a status of 403 (Forbidden) https://guarded-forest-7267.herokuapp.com/vendor/jquery-form/jquery.form.js Failed to load resource: the server responded with a status of 403 (Forbidden) https://guarded-forest-7267.herokuapp.com/vendor/jquery-validate/dist/jquery.validate.min.js Failed to load resource: the server responded with a status of 403 (Forbidden) https://guarded-forest-7267.herokuapp.com/vendor/jquery.inputmask/dist/inputmask/jquery.inputmask.js Failed to load resource: the server responded with a status of 403 (Forbidden) https://guarded-forest-7267.herokuapp.com/vendor/modernizer/modernizr.js Failed to load resource: the server responded with a status of 403 (Forbidden) https://guarded-forest-7267.herokuapp.com/vendor/jselector/src/jquery.jselector.js Failed to load resource: the server responded with a status of 403 (Forbidden) https://guarded-forest-7267.herokuapp.com/vendor/rubber-carousel/dist/jquery.rubber-carousel.min.js Failed to load resource: the server responded with a status of 403 (Forbidden) https://guarded-forest-7267.herokuapp.com/vendor/jmodal/src/jquery.jmodal.js Failed to load resource: the server responded with a status of 403 (Forbidden) https://guarded-forest-7267.herokuapp.com/vendor/scrollReveal.js/dist/scrollReveal.min.js Failed to load resource: the server responded with a status of 403 (Forbidden)

Whats the problem can be?

toliklunev
  • 303
  • 1
  • 12

3 Answers3

2

I was facing the same issue. It is because you are trying to access files inside the vendor directory. Static files inside the ‘vendor’ folder cannot be accessed due to some heroku permission issues.

I moved the files to a new directory named 'js', and re-deployed the app. Works fine now.

Abhishek Poojary
  • 749
  • 9
  • 10
1

Make sure your static directories do not have reserved word in Heroku such as vendor and bin To get more information see devcenter.heroku.com/articles/deploying-php

Rami Salim
  • 182
  • 2
  • 11
0

It was due to misconfiguration in .htaccess file

If there are any RewriteRule in your .htaccess file add these RewriteCond before it.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

For example this code allow you to redirect all requests except static files to index.php

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php
Magesh Vs
  • 82
  • 4