Tagged: CDN
- AuthorPosts
- April 28, 2022 at 6:03 am #51719Adam LuzsiGuest
Dear Customer Service,
I’m a WordPress developer and I would like to know if the W3 Total Cache (or any other plugins you have) are capable of the following:
1. Serve images hosted on Akamai CDN
2. Upload images directly to Akamai CDN instead of WordPress Media Library (i.e. the server).My current client has over 20 Terabytes of media (mostly images) hosted on Akamai CDN, and it’s crucial that whenever they upload an image it doesn’t get uploaded to the site’s hosting server, but directly to Akamai CDN.
I really appreciate any help or suggestion regarding the above issue.
Thank you in advance!
Best regards,
Adam Luzsi
April 28, 2022 at 10:54 am #51809Marko VasiljevicKeymasterHello Adam,
Thank you for your questions and I am happy to assist you with this.
W3 Total Cache does have integration with Akamai CDN and you can see that if you check the CDN dropdown under Performance>General Settings>CDN>CDN Type:
To answer both of your questions, Yes W3 Total Cache will and can upload the images to the CDN, however, W3 Total Cache cannot upload the images directly to Akamai CDN without them being uploaded to the server first. What the W3 Total Cache CDN feature does is, uploads the images and use a URL rewrite to serve those images from the CDN instead of a server.
Since this use case is not recommended this is out of the W3 Total Cache scope and to be honest, I’ve never seen a plugin that does that.I hope this answers your questions.
Thanks!
April 29, 2022 at 6:31 am #51830Adam LuzsiGuestHi Marko,
Thanks for your answer and clarification, it absolutely helps!
Let me discuss it with my client and get back to you.
Thanks,
Adam
May 9, 2022 at 11:38 am #52644Adam LuzsiGuestHi Marko,
This is a follow-up to my previous question and your reply.
So I understand now how a CDN works, and my client has bought a premium subscription for W3 Total Cache and I enabled Akamai CDN in the settings, but it’s not clear for me how it actually works.
The scenario is the following:
Let’s say my client’s website domain name is example.com I have a staging/development website setup on my own hosting account which is example.stagedev.cloud, and I’ve added the premium licence key to this staging site for now to test.
So I’ve uploaded an image (set as a featured image for a post) to the server, but on the front-end it gives me the WP uploads path and not the CDN path.
What am I missing?
Are there any other settings related to this?
Is it maybe that Akamai is configured only for the example.com domain?Thank you very much,
Adam
May 9, 2022 at 12:49 pm #52662Marko VasiljevicKeymasterHello Adam,
W3 Total Cache rewrites the URL using the Replace site’s hostname with a section in Performance>CDN.
As you can see in the description, Enter the hostname provided by your CDN provider, this value will replace your site’s hostname in the HTML.
SO instead ofyourwebsite.come/wp-uploads/2022/05/someimage.jpeg
, you will get the CDN URL for exampleakamai.yourwebsite.come/wp-uploads/2022/05/someimage.jpeg
And to answer your question, yes you also need to set up a CDN for staging website as this is a different URL.I hope this helps!
Thanks!
May 10, 2022 at 6:49 am #52669Adam LuzsiGuestThanks for the answer Marko, it helps.
Unfortunately the client says it’s not possible to create separate CDN for the staging, so I’m hoping maybe there’s a workaround?
Also let me ask:
1. what exactly do you put in the “Replace site’s hostname with” field? The full CDN domain name with the protocol? The actual CDN URL looks like this: https://cdn.yourwebsite.com/www/articles/2. Is it enough to fill in one “general” field in the “Replace site’s hostname with” section?
3. Can you please give me the links to the detailed documentation regarding the CDN settings and the Total Cache Image Service settings?
4. If W3TC doesn’t handle image resizing upon uploading a new image, can you please recommend any plugins that works best with W3TC? We want to limit image size, so as to prevent authors from uploading large images.
Thanks for your help!
May 10, 2022 at 12:02 pm #52728Marko VasiljevicKeymasterHello Adam,
1. In the “Replace site’s hostname with” field, the CDN’s edge address should be added. This is used to rewrite the URL of the static resources as I’ve mentioned in the previous post.
2. This should be added in the Performance>CND>Configuration: objects section.
3. The CDN configuration depends on the CDN provider. You can always use Generic mirror and only add the CDN”s Edge address, or use Akamai from a CDN dropdown menu and configure the CDN with Username and Password.
You can check this article for more details about Image Service.4. W3TC does not handle image resizing upon uploading a new image, so you can use some plugin for this.
Thanks!
May 11, 2022 at 12:26 pm #52781Adam LuzsiGuestThank you very much for your help Marko!
May 11, 2022 at 12:30 pm #52794Marko VasiljevicKeymasterHello Adam,
You are most welcome!
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.
Thanks!May 11, 2022 at 8:40 pm #52798Adam LuzsiGuestJust posted a review! 🙂
I just talked with the client and we have a couple more questions:
So far we have found no way to be able to test the CDN, because it returns “Test failed” from both the staging domain and from my localhost where I set the live domain in my hosts file to point to localhost.
Because of this we can just hope it will work once we go live, but since it’s a site with quite a lot of content it’s frustrating to have broken images everywhere…
Our questions are:
1. Do you have proper documentation on what each setting does on the Performance > CDN page?
2. Does the plugin check whether the image is already present on the CDN, and if not it falls back to the physical version on the web hosting server? If not then is there a way to check this?
3. Will the CDN cache get refreshed automatically if an image with the same filename gets reuploaded? (for example an author uploads the wrong image and replaces it, but the filename is the same) Or does the image have to be uploaded with a different filename?
We appreciate your help Marko!
May 12, 2022 at 12:19 pm #52850Marko VasiljevicKeymasterHello Adam,
First of all, thank you for the awesome review.
To answer your questions:1. We do not have documentation on every CDN setting since all settings are self-explanatory and of course, it depends on which CDN provider you are using and if you are using Pull or Push CDN Type. However thank you for the idea, as this might be a good article. I will add explanations below:
Host attachments: when enabled, attachments (e.g. images from the media library) are served through the CDN.
Host wp-includes/files: when it is active the files of the wp-includes folder are served through the CDN.
Host theme files: when enabled the theme files are served through the CDN.
Host minified CSS and JS files: when enabled, minified CSS and JavaScript files are served through the CDN.
Host custom files: refers to the files specified in the Custom file list that you can see in the Advanced tab of this same page.
Add canonical header: This allows you to identify the original URL with the canonical tag. Generally, search engines are able to distinguish the URL without the need to specify it, so by default, the option is disabled.
Advanced
Only purge CDN manually: by default W3TC manages autonomously the purge of the cache. If you enable this option you will purge the cache only manually, normally you don’t need to enable the function, as this was specifically added for Cloudfront users because of the huge invalidation costs on the AWS side
Disable CDN on SSL pages: By activating this option you may run into the problem of mixed content. It happens when some contents are downloaded using HTTP protocol instead of HTTPS and the browser returns a not-secure site warning. In most cases, it is better to leave this option disabled.
Disable CDN for the following roles: This allows you to choose which user roles to disable CDN for.
2. Akamai CDN, as you can see is the origin pull, which means that the files are uploaded automatically to the CDN. Once uploaded, all images and files are served from the CDN. The CDN will not serve the image if it’s not uploaded to the CDN. In this case, the image will be served from the origin.
3. It’s recommended to use different filenames for each image. So if the situation you described occurs, you should try purging the cache manually for the CDN in the W3TC settings. The problem with this is not the CDN, but the Browser Caching. For images, it’s recommended to use 1 year caching for browsers (
Expires header
andcache-control
header) so if the image has the same filename and a different image is uploaded instead, the browser will think it’s the same image and will not fetch for the new one. It’s recommended to use the option “Prevent caching of objects after settings change” in Performance>Browser Cache. This option adds the random query string to files (You can enable it only for images) for example:?xNNNNN
. This will ensure that the browser always fetches the new file from the source, in your case CDN, and all you have to do us toupdate the media query string
in Performance>Browser Cache (Just above the general section), once new image is uploaded with the same filename.I hope this answers your questions.
Thanks!
- AuthorPosts
- The topic ‘W3 Total Cache compatibility with Akamai CDN’ is closed to new replies.