Hi all,
I've spent quite some time getting advagg to work, all aggregates were generated just fine, only requests for compressed versions were stuck in a 307 loop that eventually got terminated.

I managed to make it work by inserting
RewriteBase /sites/default/files/advagg_js
and
RewriteBase /sites/default/files/advagg_css
into the .htaccess files in the aggregate directories

This can also be found in this comment.

The RewriteBase statement is nowhere to be found in the code (at least I haven't found it), is there a reason why? Or does my hoster just have a weird Apache config?

Thanks in advance,

Leo

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

leobossmann created an issue. See original summary.

mikeytown2’s picture

I ended up using this logic in .htaccess to send 404's back to the subdir root if Drupal is running in a web subdir.

  if ($GLOBALS['base_path'] !== '/') {
    $data .= "ErrorDocument 404 {$GLOBALS['base_path']}index.php\n";
  }

http://stackoverflow.com/a/8942296/125684 seems to be the case here. So yes the Apache setup is a little odd.

If you remove the RewriteBase and go to the status report page (admin/reports/status) does advagg complain about gzip not working correctly? Wondering if I can detect this and put in an option, similar to #2850290: Support the "Options +SymLinksifOwnerMatch" option for htaccess files

mikeytown2’s picture

This is how core .htaccess handles it

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /
leobossmann’s picture

If you remove the RewriteBase and go to the status report page (admin/reports/status) does advagg complain about gzip not working correctly?

Indeed it does.

So yes the Apache setup is a little odd.

That might well be, because the site is not in a subfolder, and RewriteBase is set accordingly in the base .htaccess.

Wondering if I can detect this and put in an option

I guess this would be possible, because the status report page puts out an error 307, instead of getting the compressed asset you get a redirect, that could be a clue.

  • mikeytown2 committed 651c68a on 7.x-2.x
    Issue #2850865 by mikeytown2: Detect if RewriteBase is being used and...
mikeytown2’s picture

Status: Active » Fixed
FileSize
12.26 KB

This has been committed. Let me know if this works for you.

Status: Fixed » Closed (fixed)

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

leobossmann’s picture

I just tried the 7.x-2.x HEAD from the repo, it still does not work for me, although I now get HTTP Status 200 with the redirects instead of Status 307.

I guess it really must be my crummy hosting :(

Anyway, thanks for taking the time!

mikeytown2’s picture

Status: Closed (fixed) » Active

Did you set the "AdvAgg RewriteBase Directive in .htaccess files" textfield to the recommended value "/sites/default/files" at the bottom of the obscure options section on admin/config/development/performance/advagg ?

leobossmann’s picture

Status: Active » Fixed

Sorry for the delay. Just set the obscure option and it works just fine :)

Thank you!

Status: Fixed » Closed (fixed)

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