It does seem with the use of file_create_url() that there may be issues using Pressflow D6.22...
The testing advagg does for a CDN base for the 'missing*.css' returns a relative path - and not a absolute.
With the latest advagg *.dev, I now have three places to patch in a relative to absolute URI for this?
eg:
if (($status == CDN_ENABLED || ($status == CDN_TESTING && user_access(CDN_PERM_ACCESS_TESTING))) && !variable_get(CDN_THEME_LAYER_FALLBACK_VARIABLE, FALSE)) {
$url_cdn_css = variable_get('my_cdn_css_base_url', '');
$url_cdn_css .= file_create_url($css_path . $filepath . '.css');
error_log("advagg css report: " . $url_cdn_css, 0);
$parts_css = @parse_url($url_cdn_css);
if (file_exists('sites/all/modules/cdn/cdn.module')) { // if Drupal Module CDN exists
$my_cdn_css_url = 'http://small.gdlcdn.com/802C5F/cdn1'; // get base CDN url to add to CSS
$my_cdn_js_url = 'http://small.gdlcdn.com/802C5F/cdn2'; // get base CDN url to add to JS
$my_cdn_mapping = $my_cdn_css_url . '|.css'."\n";
$my_cdn_mapping .= 'http://small.gdlcdn.com/802C5F/cdn2|.js'."\n";
$my_cdn_mapping .= 'http://small.gdlcdn.com/802C5F/cdn3|.jpg .png .gif .ico'."\n";
$my_cdn_mapping .= 'http://small.gdlcdn.com/802C5F/cdn4|.pdf'."\n";
$conf['cdn_basic_mapping'] = $my_cdn_mapping;
$conf['my_cdn_css_base_url'] = $my_cdn_css_url;
$conf['my_cdn_js_base_url'] = $my_cdn_js_url;
}
Thoughts?
Easy enough too 'correct' - just requesting others thoughts / expansion on this
See -> http://drupal.org/node/839282
Comments
Comment #1
Peter Bowey commentedThe above event / description is based on using Wim Leers CDN module project;
http://drupal.org/project/cdn
Notes: The second php code listing (above) is applied in D6's settings.php
Comment #2
Peter Bowey commentedSee https://bugs.launchpad.net/pressflow/+bug/597718
for content relating to how this new file_create_url() should be integrated into latest Pressflow.
[Changes:] After some research on this D6 file_create_url() use, I find that Drupal's (D6) method is flagged as 'buggy', and that Pressflow has 'corrected' the use (@return) of file_create_url(). Duh *beware* D6 coders...
Hence, Pressflow will not process parameters the 'OLD' D6 way. The returned value @return is not what it was under Drupal D6.
In the current case of 'advagg', this effects the value (URI expected) passed to drupal_http_request().
In my testing, this 'change' effects; Pressflow 6.20 to Pressflow 6.22
Adding Wim Leers 'comment' related to this: -> http://drupal.org/node/839282#comment-3358288
Comment #3
Peter Bowey commentedComment #4
calypso2k commentedPressflow 6.22 + CDN (in my configuration three additional domains are pointing to default drupal installation domain as it is devel setup) i've got:
Adv CSS/JS Agg - CDN Async Mode CSS CDN Issue
Check your CDN settings; CSS request is not coming back when routed through the CDN. If you are still having issues you can go to the AdvAgg information tab and select Asynchronous debug info. If creating an issue on d.o be sure to include this information.
Adv CSS/JS Agg - CDN Async Mode JS CDN Issue
Check your CDN settings; JS request is not coming back when routed through the CDN. If you are still having issues you can go to the AdvAgg information tab and select Asynchronous debug info. If creating an issue on d.o be sure to include this information.
I've red links posted by You, but i don't understand.
Can You even remotely point me to what is causing the problem and how can I solve it?
debug:
Comment #5
Peter Bowey commentedRefer #4
Yes, I will outline the fix:
Simply, we need to feed advagg a full URI, as the current file_create_url() fails to do this...
The following edits allow this:
Step 1: edit advagg.install and change thus (the + lines)
Step 2: Edit advagg.admin.inc and change thus (the + lines)
Step 3: add the following to your active settings.php:
Now the URI will be available for advagg checks.
Notes: The references to 'http://yourcdnbase.com' *need* to be changed for your cdn environment.
The 'yourcdnbase.com' [string] represents the missing 'URI' that file_create_url() fails to return (it returns only a relative path - instead of the URI to the missing 404 file location). We need a 'correct URI' to sent to the advagg drupal_http_request() **This is where the 'missing schema' error -1002 result comes from.** Note: we add the missing 'schema' (http or https).
See above code edits and previous notes on Drupal versus Pressflow use of this function.
Helpful Note: The error status showing:
is basically telling us that a incorrect 'URI' was attempted / used. 'schema' refers to the 'http/https' (or lack of it - in this case) to the next called function: drupal_http_request()
Comment #6
Peter Bowey commentedComment #7
Peter Bowey commentedLets compare the actual [current] core for Drupal 6 vs Pressflow for file_create_url() (file.inc in /includes)..
1) Pressflow 6.x: file_create_url()
Notes: This comes from the latest Pressflow 6.22 core release
2) Drupal 6.x: file_create_url()
* With Pressflow, the base_path() call in file_create_url() comes back as "/". *
Peter
Comment #8
Peter Bowey commentedComment #9
Peter Bowey commentedComment #10
calypso2k commentedmany, many thanks for Your help :)
I've made bug report @ pressflow
https://bugs.launchpad.net/pressflow/+bug/790092
Comment #11
mikeytown2 commented@calypso2k
there is a second field set on that debug page; for your case that is what we are after... I need to change that note to let people know there are 2 if you have the CDN module installed. Patch below fixes that notice; which has been committed.
Comment #12
mikeytown2 commentedFigured out the issue... it's not that complicated. Has to do with cdn_file_url_alter
Looks like when I test this I need to do a variable get; and scrub
admin*from the list, just for this page.Comment #13
mikeytown2 commentedHopefully this fixes this issue; it has been committed.
@peter bowey
This should take care of some of the hacks you had to do to advagg.
Comment #14
mikeytown2 commentedComment #15
Peter Bowey commented@mikeytown2
Hmm, interesting .....
Wim Leers (via cdn module), defines this 'default';
define('CDN_EXCEPTION_FILE_PATH_BLACKLIST_DEFAULT', "*.js\n*/image_captcha/*");I had (previously) set the CDN blacklist to ONLY "
*/image_captcha/*I note that the patch (#13 above) only deals with the CDN blacklist 'default'??
@mikeytown2, I will test new advagg.git 'patch' - later today!
Comment #16
Peter Bowey commentedRefer #13
@mikeytown2
The only advagg 'hack' I should need is the single (1) for 'prefixing' my special CDN URI case->
'http://small.gdlcdn.com/802C5F/cdn1'as I choose to not use domain name references (likesmall.gdlcdn.com.I like avoiding the millisecond lag of using CDN 'CNAMES'. I have bench-marked it to be very small with Edgecast CDN use - about 10-18ms :)
So this 'custom' prefix / method is not a coding 'concern' for advagg...
Comment #17
david straussSubscribing. Anyone have a good idea how I can improve Pressflow compatibility with Drupal behavior here?
Comment #18
Peter Bowey commentedRefer #17
@David Straus, I have outlined the Pressflow advagg method at #5.
See http://drupal.org/node/1172012#comment-4532666
It works great! (Spent a lot of time testing this)
Notes: I have *not yet* tested the new advagg.git patch submitted @ #13 -> http://drupal.org/node/1172012#comment-4541260
Update: Just tested #13 -> http://drupal.org/node/1172012#comment-4541260
It works!
Comment #19
Peter Bowey commented*Solved*
Just tested #13 -> http://drupal.org/node/1172012#comment-4541260
The latest *.dev advagg.git solves this issue with Pressflow!
Good News for Pressflow advagg users!
Report Status shows:
Thanks mikeytown2 :)
Comment #20
david straussI've reverted the change to file_create_url() in the latest Pressflow trunk, which should be accessible in Bazaar and git immediately and as a tarball within 24 hours (as Pressflow 6.22.104).
Now, back to figuring out how to solve the problem of pages being cached with absolute HTTP (not HTTPS) URLs for assets when the page gets served with HTTPS. Solving that was the original reason I modified file_create_url() to be more relative.
Comment #21
mikeytown2 commented@David Strauss
The issue here had nothing to do with pressflow. Sorry that you where alerted to this issue. The code that shipped with 6.22 works great.
Comment #22
Peter Bowey commentedRefer #21 -> http://drupal.org/node/1172012#comment-4542992
@mikeytown2
Would be good if you did explain how the above 'issue' come to exist.
I was one of at least two Pressflow users that noticed this 'advagg bug'. Did you get any 'bug reports' from the many Drupal users (not using Pressflow)?
Comment #23
mikeytown2 commentedOn all of our sites we do not have any blacklisted CDN paths; discovered the root of this bug when I did a fresh install. I was expecting file_create_url to always pass an absolute URL if the CDN module is installed.
Comment #24
Peter Bowey commentedSee this Pressflow bug report link for related 'issues' effected by the CDN module:
https://bugs.launchpad.net/pressflow/+bug/729783 (David Strauss wrote on 2011-05-31)
Comment #26
jaypanI'm seeing this issue with Pressflow 6.24, advagg 6.x-1.6, and CDN 6.x-2.3. Is there something I can show here to help debug the issue?