CDN Cloudfront setup as Push CDN in multisite - Upload and Download paths are different
soubhiksaha opened this issue · 1 comments
We are having an issue with WP Multisite’s Media Library, AWS S3, AWS Cloudfront and W3 Total Cache.
We are using WP 4.8.2, the latest version of the plugin and are using AWS Elasticbeanstalk on PHP 7.0.
Our site (example.com) uses subdirectories for multisite.
When a user uploaded a document to the 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/doc.pdf
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/doc.pdf.
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 document, they are directed to http://example.com/wp-content/uploads/sites/11/2017/03/doc.pdf (without “nashville”), which W3 Total Cache redirects to a parallel URL on Cloudfront.
So basically, the uploads go to:
http://abc.cloudfront.net/nashville/wp-content/uploads/sites/11/2017/03/doc.pdf
but are accessed from
http://abc.cloudfront.net/wp-content/uploads/sites/11/2017/03/doc.pdf
I am having this same issue. Where is the code is the upload path being set?