• Development

    Laravel + Filament + Private Disk on Cloudways

    Introduction

    After a long, frustrating debugging exercise, I have discovered a quick tip for my Cloudways + Laravel friends. The “why” is still a touch fuzzy for me at the moment, but I’ll at least explain the symptoms and the fix.

    The goal: Add a private file upload to a Filament resource form, ensuring anonymous users cannot download/view the file.

    The issue: Everything was working great in my ddev environment. I could preview and open the files if I was logged in, and I would see a 403 if I was logged out. When I moved this to a Cloudways server I was getting automatically logged-out every time I hit a private file URL. Weird, right?

    Code

    Here’s the final code (the Cloudways “fix” is further down this page):

  • Development

    404 Error Serving a /libraries page in Drupal 8

    It took some time to figure out why I kept seeing a 404 error (page not found) on http://www.mysite.com/libraries. The issue seemed to only present itself on our Acquia environments. Ultimately I realized that there was a conflict due to having a “libraries” directory in the document root of the site (e.g., /docroot/libraries).

    It was a quick fix after realizing the cause of the problem; I added this to my .htaccess file, above the other index.php rewrite rules.

    The reason this wasn’t happening on my local machine is because I’m using nginx locally for this particular website; the .htaccess file isn’t used.