Aggregate files from advagg have the protocol and host name pre-pended to them instead of being root relative. Is that expected behaviour?

In our case, sometimes that prepended host name is completely wrong, note the CSS files point to an IP Address. I can't tell where this IP address came from, but we don't serve content to requests with no host. The really odd thing is that the JS agg files are at least to the host name. Even there, my desired behavior would be root relative.

<link rel="shortcut icon" href="/sites/all/themes/example/favicon.ico" type="image/x-icon" />
<script type='text/javascript' src='//s7.addthis.com/js/250/addthis_widget.js#async=1'></script>
  <link type="text/css" rel="stylesheet" media="all" href="https://231.129.39.74/sites/default/files/advagg_css/css_feeb66203da30f44d256276b82f10bb7_0.css" />
<link type="text/css" rel="stylesheet" media="all" href="https://231.129.39.74/sites/default/files/advagg_css/css_a67ee8530221bc33d88fc2e6262439c5_0.css" />
<link type="text/css" rel="stylesheet" media="all" href="https://231.129.39.74/sites/default/files/advagg_css/css_860478e27e651acc2b8cf5d15492ff23_0.css" />
<link type="text/css" rel="stylesheet" media="all" href="https://231.129.39.74/sites/default/files/advagg_css/css_4a764b76822c5f50c499faf77f347c4c_0.css" />
<link type="text/css" rel="stylesheet" media="print" href="https://231.129.39.74/sites/default/files/advagg_css/css_db173d3721151cfc096c7337b0bd3649_0.css" />
<link type="text/css" rel="stylesheet" media="print" href="https://231.129.39.74/sites/default/files/advagg_css/css_90515a12006204e1b5a319ce77d6772b_0.css" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/example/styles/special1.css?b" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/example/styles/special2.css?b" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="https://www.example.com/sites/default/files/advagg_js/js_be3e91b7acda5c6cdadcd9142fbcd392_0.js"></script>
<script type="text/javascript" src="https://www.example.com/sites/default/files/advagg_js/js_4dbcb1a7396d39baf0d4e076899d6679_0.js"></script>
<script type="text/javascript" src="https://www.example.com/sites/default/files/advagg_js/js_f4a794344eb43f0fea1a531f2457bb3a_0.js"></script>
<script type="text/javascript" src="https://www.example.com/sites/default/files/advagg_js/js_abbef7432a33a9c6b271b016e373100a_0.js"></script>
CommentFileSizeAuthor
#10 advagg-1254382-10.patch1.93 KBmikeytown2

Comments

glennpratt’s picture

So it would seem this is happening in _advagg_build_url()

I believe this URL is needed to generate async files, but I'm not sure why that would be the emitted URL on the page (or why making that request is required, seems like a nice-to-have).

glennpratt’s picture

PS, I'm just looking through this, that may not be the way things work - or my setup may just be wrong.

mikeytown2’s picture

Are you using the CDN module?

glennpratt’s picture

Yep, that was the issue. Though we don't have the local IP as a target for CDN and aggregate files aren't being moved to our CDN yet, so we didn't expect them to be rewritten. Added *.js and *.css to blacklist at least made them use the current host. Disabling. CDN made them root relative.

Sorry for the confusion.

mikeytown2’s picture

Status: Active » Closed (works as designed)

Going to close this issue. Re-open if this is not fixed.

glennpratt’s picture

Category: bug » support

Thanks... meant for this to be a support request to begin with. I will investigate more to try and understand why they were being sent to the IP address, but probably just an issue with our configuration.

glennpratt’s picture

Status: Closed (works as designed) » Active

This is still happening with CSS and JS excluded from CDN, I wanted to blame it all on CDN, but I don't think that's the whole story.

Running drush cc advagg fixes this.

My new theory is that requests coming in (from AdvAgg? Drush?) without a host header, then advagg is cacheing that. Our edge servers don't allow requests without a host header, so those get dropped for the end user.

mikeytown2’s picture

Sounds like I should add the hostname to the cache id inside of advagg_processor()

glennpratt’s picture

That sounds like a solution to me... I haven't been able to replicate this on a testing environment, so I don't know how those paths are getting in there.

Would it be possible to only cache the paths or would that be more complicated? Perhaps a replacement string.

mikeytown2’s picture

Status: Active » Fixed
StatusFileSize
new1.93 KB

Added the hostname to the cid. This patch has been committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

glennpratt’s picture

Thanks!