• Resolved jmoran888

    (@jmoran888)


    I’m having an issue with images being served from my S3 bucket. When i upload images to my s3 bucket and remove them from my /uploads directory on my server (to save space) i configure the CDN settings in W3 Total Cache to point to the S3 bucket. However when i load my site the image urls are showing as the domain and getting 404. Which they should because they are not on the server.

Viewing 5 replies - 16 through 20 (of 20 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @jmoran888,

    Thank you for provided screenshots and sorry for the late reply.
    I can see where potential issue is.
    In Performance>CDN there s a field “Replace default hostname with:” which cannot be empty a potentially there is a notification in the top of your dashboard stating that “A configuration issue prevents CDN from working:” and “Replace default hostname with:” is one of the configuration issues.
    In order for your images to have S3.amazon URL, you need to populate that field and replace default hostname with CNAMe you created in your Amazon account.
    I hope this helps and please ask if you have any other questions that we can help you with.

    Thread Starter jmoran888

    (@jmoran888)

    Hi Marko –

    I’ve changed the CDN settings to media.<domain>.org and set up a CNAME record in my Route 53 account pointing to the S3 bucket – however when i test the URL of the images is still showing as the domain not the S3 bucket.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @jmoran888,

    The bucket name must be the same as the CNAME
    https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingCustomURLs

    If you need more flexibility, you can create a CloudFront distribution for your S3 bucket and assign a CNAME to your CloudFront distribution.

    https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html
    I hope this helps!

    Thread Starter jmoran888

    (@jmoran888)

    Thank you Marko – i was finally able to get it to work by creating a Cloudfront Distribution. I have one other question that is unrelated regarding cache-control. Do i need to set the Cache-Control header on both the W3TC configuration AND the CloudFront Distribution or is it one or the other ?

    Thanks again!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @jmoran888

    You are most welcome!
    Set Cache-Control header on both the W3TC configuration AND the CloudFront. You should test this to see how it works with your configuration.
    We would really appreciate it if you could take a minute and post a review here. This will help us to continue offering a top-notch product to users. Thank you for your help!

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘W3 Total Cache and S3’ is closed to new replies.