403 Forbidden response for assets

Silverstripe Version: 4.2.1

Question:

I am using apache 2.4.34/php 7.2.9 on Windows 7 and I made a vhost for my site like this:

<VirtualHost *:80>
    DocumentRoot "path\to\my\site\public"
    ServerName mysite.dvl
    ServerAlias *.mysite.dvl
	
    <Directory "path\to\my\site\public">		
		AllowOverride All
		Require all granted
    </Directory>
</VirtualHost>

Everything seems to be working fine, except that I get a “403 Forbidden” for my assets (e.g. uploaded images). If I remove “AllowOverride All” directive images are shown fine but then nothing else works (I get 404 for all other requests). Thank you for all your help in advance.

1 Like

Thank you for your answer. I “fixed” my problem. The cause for errors were images with dots in their names meaning I had to rename for example “my.photo.jpg” to “my photo.jpg”, so it had nothing to do with file permissions.

‘my.photo.jpg’ is a valid filename, so you might have discovered a bug.

1 Like

Thanks for making this post, I’m having the same issue. This answer from colymba on stackoverflow helped me to a point, by creating a file called assetperms.yml and placing it in app/_config/

When I make the contents of assetperms.yml contain the following

SilverStripe\Assets\Flysystem\AssetAdapter:
  file_permissions:
    file:
      public: 0644
      private: 0644
    dir:
      public: 0755
      private: 0700

everything displays fine on the front end but my Images still don’t preview on the right in the file viewer in the CMS and I get a 404 while editing blog posts even though both images are displaying:

I hope this helps narrow down the issue we are having.

2 Likes

It is a bug, it’s already been fixed (there’s a patch around somewhere) and due for release.

2 Likes