Any chance that you have a route that somehow messes with the file system (in web.php)?
Odd problem: Can not get files on subfolders of a filesystem-disk via HTTP
Hello there,
I got a very odd problem.
On Laravel Forge I can not access files like this:
curl 'https://staging.mydomain.dev/storage/media/11/0ArZWnOzipbdithj.svg'. If I attempt to do that, I am getting the 404-page of the Laravel-App.
This is the filesystems-config:
<?php
return [
'default' => env('FILESYSTEM_DRIVER', 'local'),
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'media' => [
'driver' => 'local',
'root' => public_path('media'),
'url' => env('APP_URL').'/media',
],
// ...
],
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
The symlink is created correctly:
$ ls -lah public/storage
lrwxrwxrwx 1 stagingmydomaindev stagingmydomaindev 58 Feb 16 13:21 public/storage -> /home/stagingmydomaindev/staging.mydomain.dev/storage/app/public
And the content does exist:
$ ls -lah storage/app/public/media/
total 1.7M
drwxr-xr-x 413 stagingmydomaindev stagingmydomaindev 12K Feb 16 13:09 .
drwxr-xr-x 3 stagingmydomaindev stagingmydomaindev 4.0K Feb 16 13:09 ..
drwx------ 3 stagingmydomaindev stagingmydomaindev 4.0K Feb 16 13:09 1
drwx------ 3 stagingmydomaindev stagingmydomaindev 4.0K Feb 16 13:09 10
drwx------ 3 stagingmydomaindev stagingmydomaindev 4.0K Feb 16 13:09 100
drwx------ 3 stagingmydomaindev stagingmydomaindev 4.0K Feb 16 13:09 101
drwx------ 3 stagingmydomaindev stagingmydomaindev 4.0K Feb 16 13:09 102
drwx------ 3 stagingmydomaindev stagingmydomaindev 4.0K Feb 16 13:09 103
... and many more
Well - if I create a test.txt and move it to ./storage/app/public/media/ and curl it afterwards, I get a result:
curl 'https://staging.mydomain.dev/storage/media/text.txt'
Test
If I move the very same file to a deeper folder like the folder 1 and curl it, I am getting the 404 again.
@ahoi Not sure if it is the cause, but try setting 'visibility' => 'public', on the media storage disk.
Please or to participate in this conversation.