WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Amazon S3 images not being served. (14 posts)

  1. onerock
    Member
    Posted 2 years ago #

    I have just implemented both w3-total-cache and Amazon S3. I have configured the CDN portion and successfully uploaded the files via the plugin. When I enable the "Host Attachments", "Host wp_includes/files", and "Host Theme Files" as well as enable the CDN feature under the general tab, my site appears "broken." When I disable the individual CDN features, my site looks correct. What am I missing to make this work? thanks in advance for your help.

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. onerock
    Member
    Posted 2 years ago #

    This issue has been resolved. First, my CNAME and bucket name weren't correctly formed. The bucket name must be in the form of something like cdn.your_domain.com and the CNAME must be the same as what you have chosen before the first dot and points to s3.amazonaws.com. This translates to cdn.your_domain.com.s3.amazonaws.com. Secondly, you must at least assign a bucket permission "View Permissions" to "everyone." There may be ways to restrict this further, but I am not currently aware

  3. onerock
    Member
    Posted 2 years ago #

    Correction... the CNAME points to the name assigned by Amazon. It is usually a long string of alpha numerics and looks similar to this. alpha_numeric.s3.amazonaws.com

  4. mohanbn
    Member
    Posted 2 years ago #

    Well, with both the settings, i get to see the calls in html as cdn.domain.com for all images instead of cdn.domain.com/x.png or cdn.domain.com/y.jpg

    The HTML itself is being malformed. Any solutions for this?

  5. onerock
    Member
    Posted 2 years ago #

    Have you enabled all of the setting in the W3 Total Cache plugin for CDN? There is a "Host custom files" section under CDN, that must specify what folders you want to be "redirected". This is what add the remainder of the html link.

  6. onerock
    Member
    Posted 2 years ago #

    The link that is posted appears to go to the Amazon home page. Please re-post.

  7. pmfox
    Member
    Posted 2 years ago #

    I have the same result as mohanbn. This seems to be if only using S3 and NOT Amazon Cloudfront as the CDN.
    Instead of pulling the file in cdn.domain.com/picture.jpg it generates html as cdn.domain.com. It doesn't fill the folder or file in the rendered html.

  8. onerock
    Member
    Posted 2 years ago #

    This is because Amazon S3 is a push technology and not a pull technology like Cloudfront. Below are a couple of good articles that helped me understand the difference.

    CDNs - push vs pull
    Amazon S3 vs Amazon Cloudfront

    I haven't messed much with Clouldfront, yet, but I will be once I get my site fully implemented/functional. For S3 to work this is what I did...

    Under the main W3 Total Cache admin page, scroll down to the CDN section and select "Amazon Simple Storage Service (S3)". Do not enable yet.

    Under the W3 Total Cache admin, go to CDN tab. In the general section, under :Host custom files" must be enabled. Under the "Configuration", obviously the Amazon S3 info must be filled in. :-) In the "advanced section, the "Custom file list:" must include the ftp directory of the files you want served from S3. I use the Nextgen Gallery plug in so I had to include "wp-content/gallery/*" in my list. That may be a default now, but not sure.

    You can now use the buttons in the general section to upload your files to Amazon S3. The "Upload Custom Files" didn't work for me because my gallery is somewhere in the neighborhood of 2 gigs and I am sure that it wasn't designed for such a large load. I manually move my files with 3rd party sync software.

    After your files are uploaded to Amazon S3, you can enable the entire CDN feature on the main

  9. pmfox
    Member
    Posted 2 years ago #

    Onerock,
    That may be the problem. I set up a subdomain a while back to host my images. So I have subdomain.domain.com/uploads as the current hosting of images. Now, since WordPress recognized that as my uploads directory W3 uploaded all the images into S3 without any problem. The issue is displaying them.
    So, if what I'm reading is correct, I need to add that directory (subdomain and directory) to the Custom File List in the Advanced section of the CDN settings. Is that correct?

    Thanks for the follow up.

  10. pmfox
    Member
    Posted 2 years ago #

    Also, I should add, even though I'm using subdomain.domain.com/upload as my upload directory, W3 uploaded the files to S3 in the name.s3.amazonaws.com/uploads directory. I don't know if that matters.
    Thanks.

  11. onerock
    Member
    Posted 2 years ago #

    I would try putting that in the custom file list. It is interesting that it recognizes them for the upload feature, but isn't substituting the CDN portion of the URL.

  12. pmfox
    Member
    Posted 2 years ago #

    My problem isn't the custom files. The problem is the uploads. As I said, I use the domain z.domain.com/uploads to hold all my uploaded media through WordPress. All my links in the posts, etc, are http://z.domain.com/uploads/file.jpg.
    When I activate the CDN, the CSS is working fine and pulling from cdn.domain.com/folder/file
    It's only having issues with the images that pull from z.domain.com/uploads.

    Maybe I'm misunderstanding what the purpose of the custom uploads option is for but I don't know if it applies to what I want to do. This should be working with the upload attachments option.
    Thanks.

  13. onerock
    Member
    Posted 2 years ago #

    I agree that it should be working as is. I was suggesting adding it in to the custom section to see if that had any affect.

  14. Demlaip
    Member
    Posted 1 year ago #

    Thanks onerock, but I'm still facing this issue, even though I followed your suggested naming convention of bucket.
    Problem is: some icons on site UI are broken and some resources of site are pointing to their 'gzip files, which disappear once I disable CDN in W3TC.
    Hence it would be great help to get your some words on this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic