Closed (fixed)
Project:
CDN
Version:
7.x-2.x-dev
Component:
Origin Pull mode
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Apr 2011 at 15:06 UTC
Updated:
7 May 2016 at 04:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
wim leersThis is the reason:
Clearly, only images are currently supported in node bodies. It is doable to add PDF support though. But since this is only rarely needed, I'm going to leave this is a feature request that is yet to be implemented. I'd definitely welcome a patch that adds this, of course. To qualify to be committed, it will need to be neatly integrated with the config UI, too, though.
Comment #2
wim leersUpon looking at this issue again, I thought I should automatically serve any "downloads" from a CDN. So: presentations (.pdf, .key, .ppt, .pps …), rich text (.doc, .docx, .rtf, .pages …), archives (.zip, .7z, .rar …), but … these files are often served using private file downloads. But often these are served using private downloads.
Plus, there's nobody else requesting this functionality. So I'm about to just close this issue, unless somebody objects.
Comment #3
Stealth commentedI am not able to get orgin pull to with with .swf files
Comment #4
vacilando commentedTrue, but that statement could also apply to images.
In other words, the decision whether or not to CDN a file should remain the responsibility of the site admin and not limited by the module.
I would still very much welcome if CDN allowed serving any kind of file (if specified by extension).
Comment #5
wim leersThe problem is that it's by definition not supported to serve private files from a CDN, because then the "private" nature of the file can no longer be guaranteed. Some CDNs support this, but they all have different mechanisms…
However, if the files are served publicly, then you're absolutely right.
Comment #6
wim leersPrivate files support is answered here more completely: #1294822-4: Document private files support.
This issue is now solely about supporting non-image files in node bodies using Drupal's "public files".
Comment #7
wim leersAttached is an initial, untested patch for D6. Likely, you'll have to make changes to the regex.
Note that this is pretty much a non-issue in D7: File Field URLs will automatically be altered by the CDN module, and hence this will just work there. Except when you link to these files from within the body of a node, then a similar patch will be necessary.
Comment #8
vacilando commentedPatched the latest D6 dev, turned out invalid HTML.
The PDF at this link got malformed -- the second quotation mark was encoded into %22 so the URL never finished.
Something like
<p><a href="sites/vacilando.net/files/pdf/rocnikovka/rocnikova_praca_19890523.pdf%22%3EPopis%20ro%C4%8Dn%C3%ADkovej%20pr%C3%A1ce%3A%20pripojenie%20...Comment #9
brettbirschbach commentedJust hit this issue as well...was trying to leverage the CDN to serve public PDFs on our site.
Comment #10
wim leers#9: then please test #7 and reroll the patch as needed!
Comment #11
brettbirschbach commented#10: On my TODO list, thanks!
Comment #12
brettbirschbach commentedDoes fixing this issue fundamentally conflict with https://drupal.org/node/1623252? I have a local D7 implementation of the patch from #7, but it undermines the solution for https://drupal.org/node/1623252.
Looking at issue https://drupal.org/node/1623252, I'm not sure what it means that the module is "improperly" converting the link reference to a CDN URL. In my mind the link is only converted if it matches the extensions configured to use the CDN, which I see as desirable. Please help me out with the piece I am missing.
Comment #13
brettbirschbach commentedAttached is a first go at a D7 patch for this issue.
I coded the solution in such a way that anchor links are converted to CDN links *only* if the extension of the anchor link specifically matches a defined extension for the CDN mapping. That way we don't convert things like /node or /hello.html.
Updated/added tests as well.
Comment #14
brettbirschbach commentedNew patch, adding a missing comment and fixing an issue where occasionally a call to cdn_load_include was needed.
Comment #15
meecect commentedWe just got hit by this today. We had pdf's uploaded into our public file directory and a content page was created that linked directly to it in the node body. This is not an unusual case for us. What else is needed to get this committed? Testing #14?
Thanks,
Cliff
Comment #16
wim leersRerolled.
Comment #17
wim leersSorry for taking such a long time. Since #14 includes test coverage, I feel confident committing this as-is. I have only tiny nits.
Comment #19
wim leersOops. Interdiff was right, patch was not.
Comment #21
wim leersThanks again! :)
Comment #22
brettbirschbach commentedYou're welcome! :)
Comment #23
joelpittetI just ran into something I think with this.
URLs seemed to be generated as this:
http://example.com/abc123.cloudfront.net/sites/default/files/js/js_y-bxY...
When the mapping is just 'abc123.cloudfront.net'. Does this mean the protocol is not required in the mapping? Or maybe it always was?
Comment #24
wim leers#23: could you perhaps open a new issue? And post both the original markup and the resulting markup? That would answer a few initial questions I have.
Comment #25
joelpittet@Wim Leers good call, I had a small discrepancy between staging (which didn't have CDN turned on before testing) and production which had the protocol already in there.
Comment #26
joelpittetAdded a new issue as a documentation, probably unrelated to this, just the IS on this was helpful.
#2667156: Add help text or documentation on CDN mapping patterns
Comment #27
wim leersSo, no actual problem, is that what you're saying?
Comment #28
joelpittet@Wim Leers may need a different issue for the 'problem' which is protocol-less mappings. But I need to confirm it wasn't something stupid I did first;)
Comment #29
wim leersAnd yes, just providing a domain isn't enough; it must be either
http://absolute-url.comor//protocol-relative-url.com. That's always been the case.Comment #31
brettbirschbach commented