Hi,
I just upgraded the CDN module on D6 and suddenly the websites failed to respond. I tracked the issue down to the the new Far Future expiration feature which is active by default:
line 41 @ cdn.module
define('CDN_BASIC_FARFUTURE_DEFAULT', TRUE);
I didn't had the time to check this feature and how it can improve the performance in my websites, but this doesn't seem to be a standard feature on all CDNs, so I really think you should be more careful when upgrading the module.
For now, I've managed to work around the issue by changing the source code to:
define('CDN_BASIC_FARFUTURE_DEFAULT', FALSE);
... which is not a desirable solution at all.
Are you going to keep this as is? In that case where can I find some good documentation regarding the usage of this feature on a CDN server?
Thanks in advance,
Rolando
Comments
Comment #1
Wim LeersThis is not a feature that needs to be supported by CDNs: it's a matter of the site supporting it. You can find the documentation in the module, if you just enable the Advanced Help module.
Could you please provide more detailed information? "failed to respond" is definitely not enough information to track down this problem.
FWIW, this is running on both a D6 and a D7 site in production of mine, without problems. I wouldn't have released it otherwise. It should work just fine, which is why it's enabled by default. Let's fix this ASAP!
Comment #2
rolando.isidoro CreditAttribution: rolando.isidoro commentedHi Wim,
first, thanks for your quick reply. Second, I've looked into the module's Advanced Help info, but I'm still not sure what's the best way to workaround the problem I've experienced.
To give you some more insight on the issue here some additional info. I'm not using any commercial CDN solution, I've set up a origin pull local CDN solution based on nginx just to separate the HTTP requests and ease of the load on the main server.
After updating the module the websites didn't open, and all CDN requests where returning 404. For example the original CDN URL was something like:
after the update it became:
From the looks of it, I guess I have 2 options:
Do you see any other way to work around this?
Thanks again,
Rolando Isidoro
Comment #3
Wim LeersThis is only a problem when enabling the Far Future expiration setting + a static file server. It works fine when used with a "regular" CDN.
You can solve this by rewriting
/cdn/farfuture/***
URLs to***
. See the .htaccess at #1413156: .htaccess rules for Far Future expiration: make it possible to use the Far Future feature directly in Apache, avoiding PHP for an example. Pleas let me know your nginx config so I can document this.Comment #4
rolando.isidoro CreditAttribution: rolando.isidoro commentedHi Wim,
the solution you mention, to add some additional rewrite rules will only increase the type of URLs the nginx server can handle, but won't provide any significant improvement.
Regarding the nginx config, there's not much to it, we're using a shared FS mount for both the main server (Apache) and the CDN (nginx), so basically we only have the following to guaranty that the ImageCache files get created upon the 1st request:
Nonetheless, keeping the Far Future module setting turned off by default still seems the easiest and most compatible solution.
Best regards,
Rolando Isidoro
Comment #5
Wim LeersI was actually asking for an nginx config similar to #1413156: .htaccess rules for Far Future expiration: make it possible to use the Far Future feature directly in Apache, avoiding PHP. That *should* solve the problem at hand.
Comment #6
rolando.isidoro CreditAttribution: rolando.isidoro commentedHi Wim,
I understand what you're asking, but what I don't get is why this new feature is active by default. I find it even harder to conceive why can't I deactivate it, even if I explicitly uncheck the option in the configuration form.
Simply put, you added the far future option and there's no way someone using your module to not use it, right?
Best regards,
Rolando
Comment #7
Wim LeersThere's a simple checkbox to disable on the "Details" page…
Comment #8
rolando.isidoro CreditAttribution: rolando.isidoro commentedWim,
on the previous version of the module, 6.x-2.2, the "cdn_farfuture_status" variable wasn't written with value 0 on the DB when I saved the details configuration form, resulting on the behavior to fallback to the value set on the constant CDN_BASIC_FARFUTURE_DEFAULT. In the meantime I've update to 2.3 and now it does, which means that I'm now able to deactivate it.
But check my case, I have 20+ sites, all using the CDN module. At this point I would have to go through each site and save the CDN details settings form with the the Far Future expiration unchecked. Does it seem reasonable?
Best regards,
Rolando
Comment #9
Wim Leers#8: The Far Future feature has not been active by default since version 2.4.
Marked #1595498: Nginx config for sub-domains as a duplicate of this one.
Note that I can't provide this config file, because I don't use nor have any experience with nginx. So I hope the community will contribute it.
Comment #10
Wim LeersMarked #1724000: Can I use far-future expiration on omega8's nginx setup? as another duplicate of this one.
Comment #11
jtbayly CreditAttribution: jtbayly commentedWe're getting somewhere on this over at #1728616: Support CDN module, for all who are interested.
It's specific to the Omega8 setup, but it shouldn't be hard for somebody with Nginx experience to modify it.
-Joseph
Comment #12
Wim LeersThat's AWESOME! :)
Comment #13
Wim LeersComment #14
Wim Leers#1413156: .htaccess rules for Far Future expiration: make it possible to use the Far Future feature directly in Apache, avoiding PHP was committed, would be great to get this done as well.
Comment #15
Wim LeersMarked #2331829: Add Nginx Configuration example in README.txt as a duplicate.
Note that #1413156: .htaccess rules for Far Future expiration: make it possible to use the Far Future feature directly in Apache, avoiding PHP already contained partial nginx examples, but they were less well tested, which is why I didn't commit them there yet.
Comment #16
Wim LeersComment #17
Wim LeersFrom #1413156-23: .htaccess rules for Far Future expiration: make it possible to use the Far Future feature directly in Apache, avoiding PHP, by @omega8cc:
:
Would be great if nginx users could test that.
Comment #18
Wim LeersClearly interest in this is very low. Since @jtbayly in #11 back in 2012, nobody has commented on this.
Comment #19
glynster CreditAttribution: glynster commented@Wim Leers we just added this to a production site and works like a charm. We were having issues with background images in CSS files and fonts. With your Nginx snippet all works well. Thanks so much!