Grade F on Add Expires headers

There are 19 static components without a far-future expiration date.

Most of the elements are from the advagg_js and advagg_css directories

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeytown2’s picture

If you go to the status report page admin/reports/status what does that report for AdvAgg?

mikeytown2’s picture

Status: Active » Postponed (maintainer needs more info)
BarisW’s picture

Status: Postponed (maintainer needs more info) » Active
FileSize
178.81 KB

I have this same issue. All lights on the reports page are green, but pagespeedtest report missing expires headers. See screenshot.

Without Advagg enabled, this does not happen.

OriginalSauce’s picture

Hi,

Although I did not get the same message from webpagetest, I did have a similar issue that stopped the far future headers being set. (and the report status page was all green)

I found a conflicting server configuration that was causing the directives set in the .htaccess file, found in advagg file paths, to be ignored.

It's probably not what you are experiencing, but it is worth checking that the .htaccess directives are being applied.

mikeytown2’s picture

I've committed this change; it will change the blacklists to be blank before file_create_url is ran. Default auth blacklist is admin*; this change will now test the normal and CDN path on the status page.

Diff isn't clear but I added in this bit of logic

    $urls = array();
    $urls[] = file_create_url($url_path . '/' . $filename);
    if (module_exists('cdn')) {
      // Get CDN defaults.
      $blacklist = variable_get(CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_VARIABLE, CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_DEFAULT);
      $auth_blacklist = variable_get(CDN_EXCEPTION_AUTH_USERS_BLACKLIST_VARIABLE, CDN_EXCEPTION_AUTH_USERS_BLACKLIST_DEFAULT);
      // Set CDN blacklists to be empty
      $GLOBALS['conf'][CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_VARIABLE] = '';
      $GLOBALS['conf'][CDN_EXCEPTION_AUTH_USERS_BLACKLIST_VARIABLE] = '';
      // Create URL
      $urls[] = file_create_url($url_path . '/' . $filename);
      // Set CDN blacklist back to the original value.
      $GLOBALS['conf'][CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_VARIABLE] = $blacklist;
      $GLOBALS['conf'][CDN_EXCEPTION_AUTH_USERS_BLACKLIST_VARIABLE] = $auth_blacklist;
    }
    $urls = array_unique($urls);
    foreach ($urls as $key => $url) {
...
BarisW’s picture

Actually, it seemed that I needed to enable the mod_rewrite. That solved the issue.

What's weird is that all lights were green in the Status Reports page.
I've tried DEV and the issue is still there.

mikeytown2’s picture

My only guess as to why the headers come back ok on the status page is that the internal HTTP request is hitting drupal, where as external HTTP requests are hitting apache and bypassing Drupal. I should be able to detect if this is happening but I can't think of a way to code around this unless using some sort of open proxy (like http://en.wikipedia.org/wiki/Coral_Content_Distribution_Network add .nyud.net to the end of the hostname and try again if website is externally routable).

mikeytown2’s picture

Status: Active » Fixed
FileSize
2.79 KB

I've added in a check to see if the file was generated on demand (from drupal) or served via Apache. I'll be adding in documentation on what to do in this issue #2097033: "cache-control's max-age header" and "The expires header"

BarisW’s picture

Amazing, thanks!

Status: Fixed » Closed (fixed)

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