- AuthorPosts
- February 19, 2024 at 8:58 am #125079saw parGuest
Hello,
I have been using the free version with wordpress on azure appservice and azure cdn. Evaluating the produce before making the decion to buy. The problem is that when I minify the files with W3 total cacche, the minified files do not get served by the CDN. These are servied by main app service only. I read in another topic that W3 total cache won’t serve from CDN if the minify is enabled, minify is manual (not auto). Can you please tell me why the minified files are not served by CDN and is this a feature that you can roll out soon?
Thanks
February 19, 2024 at 12:46 pm #125142Marko VasiljevicKeymasterHello,
Thank you for reaching out and I am happy to help!
The minified files should be served from the CDN, and that should not be a problem.
In W3 Total Cache, you have to push and pull CDN Type and also the options To serve minified files.
Can you please share your website URL and the screenshot of the CDN settings?Thanks!
February 20, 2024 at 12:42 pm #125154saw parGuestTest environment: https://expertcetest.azurewebsites.net
Please check document with the issues highlighted: https://1drv.ms/w/s!AkfdkBaMyxklibQA8QrTpe8o8hFLPA?e=9vxJDGthanks
February 20, 2024 at 1:26 pm #125206Marko VasiljevicKeymasterHello,
Thank you for your feedback.
Is there a reason why the Rewrite structure is disabled is disabled? Are you having issues with the rewrite on your environment?
How it should work is when the Files are minified (manual or Auto) they should be stored in the /cache/minify/ folder if you are caching to disk.
the Rewrite structure is disabled, which may also be related to the gzip compression. You should also check if you have zlib enabled and that may be causing double compression.I cannot replicate any of those things you mentioned as the files are minified correctly, gzip is enabled and the files are uploaded to the CDN.
When it comes to the javascript errors, I can confirm that the W3 Total Cache does not remove anything from the files when minified, so you may want to disable minify and see if any of the files are corrupted or if you are getting the errors in the console.
You should also provide details about your environment, the setup, the PHP and the wp version, the type of server, and the plan with your hosting provider.I also want to mention that the replies will not be faster if you ask the same question in multiple channels, like here, via the plugin or the chat. Please understand that some issues are very specific to the environment and the server configuration and cannot be easily replicated.
Thanks!
February 20, 2024 at 1:28 pm #125207Marko VasiljevicKeymasterHello,
I just want to add that manual minify is an advanced technique of minification that allows you a lot of freedom on how you wish to minify the files.
There is no straightforward way of doing this as it all depends on the website, the file dependency, and the number of JS files.
Thanks!February 21, 2024 at 10:25 am #125214saw parGuestAlso note that when I enable the rewrite structure and empty the cache. Reload the page it is not able to find the minified files. Please see screenshot.
https://snipboard.io/8ErYMS.jpgI also checked that minified files are not present in the minify folder.
Also the url doesn’t point to CDN but points to app server.thanks
February 21, 2024 at 10:25 am #125215saw parGuestWP Optimize is able to minify the css and javascript well.So it is not a corrupt javascript file thing. The reason I bought w3tc plugin is because I wanted to keep the CDN support. So my two key problems are 1. Minification errors out. When w3tc send the file back.
You can check it easily yourself by access this link. Please check the last line of the content. The last 2 characters in the content are missing. Note that the file created on the server is complete and has last 2 characters.
https://expertcetest.azurewebsites.net/?w3tc_minify=91abb.default.include-footer.dc7512.js2. CDN:
Rewrite structure results into 404. because the minified files on the server are not created.
Disabling rewrite structure servers the file from https://expertcetest.azurewebsites.net/?w3tc_minify=91abb.default.include-footer.dc7512.js endpoint and CDN is not used.thanks
February 21, 2024 at 10:25 am #125212saw parGuestJavascript minification issue
Issue is happening with several javascripts. While there few other javascripts that w3tc is able to minify. In other words works for few javascripts. All javascripts on website work fine if I disable the w3tc. Absolutely no js errors in the console on any page.
This is an example:
Step 1:
On my website you will see a javascript with name: wp-content/plugins/learnpress-wishlist/assets/js/wishlist.min.js
Step 2:
When I add it to minify configuration: https://snipboard.io/rEoSx0.jpg
Step 3:
Please see the url , which is w3tc url to get the minified script. Also note the error and last 2 characters missing: https://snipboard.io/WhU04f.jpgThis file works fine when w3tc is disabled.
Env:
I am using wordpress on azure app service.
WP version 6.4.3
Learnpress version is 4.3.6
php 8.2.15
Host is Linux. App Service on Azure runs it in Docker containers.February 21, 2024 at 10:26 am #125250Marko VasiljevicKeymasterHello,
Thank you for your feedback.
Let me investigate this more and check all the details and I’ll get back to you once I have more information on this.
Thanks!February 22, 2024 at 12:21 pm #125310saw parGuestHello,
I made a bit more progress today and wanted to update you.1. Accessing files with “rewrite file structure disabled” continues to remove last 2 charcters from the javascript content. Example: the end of this file: https://expertcetest.azurewebsites.net/?w3tc_minify=91abb.default.include-footer.dc7512.js
2. This is new info. Enabling rewite file structure has started working. I added config into nginx.conf. I somehow did not realize I am supposed to do this manually. I thought w3tc does it automatically.
3. When the rewrite file structure is “enabled”, the files that are specified under manual minification get minified fine but url of these files points to app server url and not CDN. Any idea how I can ensure that the minified files are served through CDN?
Can you please help investigate point 3 first and then point 2.
Thanks
February 23, 2024 at 10:45 am #125685Marko VasiljevicKeymasterHello,
Thank you for your patience and the details provided.
In 99% of the cases, there is no need to add anything manually so it’s all down to the server configuration and if the server allows the plugin to modify the files or not.
We cannot force this so in some cases such as yours, the server configuration prevents this.
I’ve checked the files and as I can see the rewrite is now taking place, and all the files look good in terms of not removing the characters. Can you please confirm this?
As for the CDN, and the minified files not being uploaded to the CDN, if you are using origin push, you may need to invalidate those files manually.
You should visit the page as logged in. That will find out which minified URLs are used by that page and the queue upload process of minified urls.
Go to the backend and check that the upload queue is empty. if not – process it.
visit page as logged in again. it should use cdn urls now.
Now you can purge the page cache and visit it as an anonymous user to check that cdn urls are used by page cached version tooI hope this helps!
Thanks!
February 23, 2024 at 12:20 pm #125688saw parGuestI got your response in email and that mail says “DO NOT REPLY”. The link on that email takes me to this thread but in here I do not see your response. Excellent way to confuse both you and me. 🙂
1. If I disable “Rewrite URL structure” on the minify page and keep javascript files like “wp-content/plugins/learnpress-wishlist/assets/js/wishlist.min.js” in the end of manual minify configuration it errors out by removing 2 characters. Yes if I add another file below wishlist.min.js then it works.So this file needs to be in the end. There are several javascripts that hit this issue when placed in the end. It feels like a defect in w3tc.
2. Anyways the “Rewrite URL structure” enabled works. But my links of minified files when page loads still point to the app server.
Take example of this minified files that gets loaded when I access homepage. The url is of app server
https://expertcetest.azurewebsites.net/wp-content/cache/minify/91abb.default.include-footer.591d7c.jsAlthough the file is available from CDN:
https://expertcete-a65d25cea7e3acc5-endpoint.azureedge.net/wp-content/cache/minify/91abb.default.include-footer.591d7c.jsHow can I force it to rewrite the url on the home page to pick these files from CDN.
Thanks,
SawanFebruary 23, 2024 at 12:22 pm #125693Marko VasiljevicKeymasterHello,
We’ve received your reply.
Thanks! Can we please continue the correspondence via the support channel (email) to avoid duplicating the answers?
Thanks! - AuthorPosts
- The topic ‘Minify and CDN’ is closed to new replies.