i wanted to share my experience about a part of this module.
First, I have configured the CDN module in origin pull mode and set the subdomains with appropriate extensions.
Now, the urls are rewritten to appropriate subdomains but I meet a problem with imagecache.
The images created when i insert content are not generated with imagecache preset when i visit the node page, but if i replace the subdomains used by images of the webpage by the normal subdomain of the site, the images are generated correctly.
in the static Vhost , i've add this rewrite rules to redirect files that doesn't exist to the normal subdomain
#exemple subdomain istatic.domain.com for the jpeg in origin pull mode
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://www.dns.com/$1 [L]
The first time the url is accessed on the www subdomain and others he access to istatic subdomain
Now the images are generated.
I wanted to know if i miss something because i'm running pressflow with the imagecache patch and i don't understand if it is censed to resolve this problem. i run the last dev of cdn fyi.
Thx
Comments
Comment #1
wim leersThe latest dev == RC6.
Can you share your CDN mapping configuration?
Comment #2
edjay commentedyes the rc6, sorry
here my mapping conf
http://istatic.dns.fr|.png .gif .ico .jpeg
http://jpstatic.dns.fr|.jpg
http://fstatic.dns.fr|.css
http://mstatic.dns.fr|.eot .ttf .swf .pdf .zip .woff .js
http://cjstatic.dns.fr
Comment #3
wim leersAha, so you're using the CDN module with self-hosted subdomains, and not with subdomains that are CNAMEs for an Origin-Pull CDN?
Comment #4
edjay commentedyes. In fact, my subdomains are hosted by ovh (cname) and point to my webserver. i use that to parallelize downloads during navigation. i was using fileconveyor when i've started to configure cdn module. Maybe the parallelize module is more appropriate to me now.
Comment #5
wim leersWhat's ovh?
All functionality provided by the Parallel module is included in the CDN module. The Parallel module will provide an upgrade path to the CDN module: #933942: Merge Parallel and CDN modules: migration path. Switching to the Parallel module won't fix anything, it works identically in this case.
Anyway, I think the reason for those images to not be generated, is that your Drupal instance is not being called for those subdomains, hence ImageCache is not being called. This is not an issue when you use Origin-Pull CDNs, because they will contact the origin to fetch the file, meaning they will hit ImageCache.
Comment #6
edjay commentedovh is my hoster.
Effectively, i only authorize the extensions of the mapping conf for that subdomains to avoid the navigation and the creation of a cookie (static subdomains).
Comment #7
wim leersThe only way to fix this, is through ensuring the file is accessed through the Drupal website domain the first time. There are generally two ways to achieve this:
1) if the file does not yet exist, link to the Drupal domain.
2) if the file does not yet exist, generate it first from within the PHP code.
Option 1 is better if there are many images on the same page: the page generation time might become too long for option 2.
Option 2 is better if it the output will be cached, because then the cached content will link to the CDN URL, whereas with option 1, it will link to the Drupal domain instead of the CDN until the cache is cleared.
Thoughts?
Marking as minor because few people use this module with virtual hosts instead of CDNs.
Comment #8
mikeytown2 commentedsomething to look at
http://drupal.org/node/597178#comment-2735418
This will redirect all requests to your subdomains (CNAME) back to your webroot. So what I do is have all your CNAMES point to the same dir and use htaccess rules to prevent duplicate content issues.
Alt is to redirect to main site if image doesn't exists; this is needed if the CNAME is pointing to a different directory OR if subdomains will not run PHP code.
So in this case this set of htaccess rules should cover all both conditions. Untested code below!
Comment #9
wim leersAny feedback, edjay?
Comment #10
wim leersImproved title.
Comment #11
wim leersI think this can be closed now. Feel free to reopen!
Comment #12
vishalchavda commentedHello
I have tried to write the rewrite conds, but they dont work for me.
I have a site: http://example.com
with a CDN defined by a CNAME at cdn1.example.com
I only want to parallise images from the CDN i.e. .jpg .jpeg .png etc
The cdn1 directory (created as part of defining the CNAME) is empty.
regards
Comment #13
stevethewebguy commentedDruuudes! I got you here I think:
Point your subdomain cname vhosts FILEPATH to the same directory as your webroot, not the dorky, empty, cdn1 folder! This will do everything you need and possibly blow your mind away:) mirror the subs off the same webroot, then setup redirects (404s are better in his situation though) for "requested wrong file type on whatever domain" remember your root in the cdn setup textarea needs an OPPOSITE RULE, so it serves ANYTHING THAT'S NOT ASSIGNED TO A SPECIFIC (FAKER)CDN-SUB.
This is my sandbox project if you want "pressflow based distri with the needed CDN configuration options available as a part of the install wizard DB/site info setup: FastFlow Wont have it's first dev D7 release untill next weekish. I welcome help if intrested in contributing to the cause!
Knowledge. Dropped.
you picking it up?! Lemmy know if it works out as well as I think I know it should.
Peace love and kind regards,
Stevie T
http://www.plattdaddy.com/
http://www.thewebsitewhisperer.com/
Comment #14
vishalchavda commentedHello
Got this to work as per suggested here (also same as #13 above).
http://groups.drupal.org/node/25271#comment-595089
I am using .htaccess file and have access to my settings.php file.
I have an issue with setting the subdomain to be cookieless. YSlow is flagging my cdn1 served images are serving cookies. Any help on how to set up a cookieless domain would be very much appreciated.
I have explained the set-up here http://groups.drupal.org/node/25271#comment-598389
Regards
Vishal
www.thatscookedby.com