Replies: 0
We are having an issue with WP Multisite’s Media Library, AWS S3 and W3 Total Cache.
We are using WP 4.7.3, the latest version of the plugin and are using AWS Elasticbeanstalk on PHP 7.0.
Our site (example.com) uses subdirectories for multisite.
Before we switched to AWS S3 + W3 Total Cache, when a user uploaded an image to the media library for a specific site (in this case, “nashville”), the URL was, for example:
http://example.com/nashville/wp-content/uploads/sites/11/2017/03/image.jpg
Notice the city in the URL before uploads. I am not a WP expert, but I assume this was an alias of sorts, because on disk, the file exists as [DocumentRoot]/wp-content/uploads/sites/11/2017/03/image.jpg.
Now, when adding AWS S3 + W3 Total Cache to the mix, things get more complicated.
Uploads get sent to S3 and exist in the S3 bucket at “nashville”, which is *at the same level* as wp-content.
When the user looks at the media library thumbnails and such, they are directed to http://example.com/wp-content/uploads/sites/11/2017/03/image.jpg (without “nashville”), which W3 Total Cache redirects to a parallel URL on S3.
This URL in S3 does not exist, giving them an HTTP 403 error (this is the bug). However, after a certain amount of time, something (W3 Total Cache? S3?) creates this file in the S3 bucket, and the image is usable. Of course, this means that there are two copies of the file in the S3 bucket, which costs $.
I am baffled by this bug, and is causing user confusion. Any insight into why and how we can fix it?