I am using the version 7.x-2.4 and in the following page /admin/reports/status i have the below error:
The error suggest to checkthe following link:
http://:@www.testnetwork.cu.cc/sub-folder/sites/default/files/advagg_js/...
and
http://:@www.testnetwork.cu.cc/sub-folder/sites/default/files/advagg_css...
but when i go to those links i got the following:

The requested URL /sub-folder/sites/default/files/advagg_js/js__1497524159.js was not found on this server
and
The requested URL /sub-folder/sites/default/files/advagg_css/css__1497524159.css was not found on this server.

Even though i am not sure if this is a false report or no, I added the following line to my settings.php:
$conf['advagg_skip_404_check'] = TRUE;
$conf['advagg_skip_404_check'] = TRUE;

and the error gone for good,

can you please explain how to resolve this error ?
and is it safe to keep those lines in my settings.php since it seems to me that those line only prevent the error from being displayed and do not actually resolve the issue !

Thank you,

Adv CSS/JS Agg - HTTP Request	HTTP requests to advagg for js files are not getting through.
AdvAgg will issue a request for a file that does not exist inside of the AdvAgg directory. If AdvAgg sends a 404, everything is ok; if something else sends a 404 then that means that AdvAgg will not be able to generate an aggregate if it is missing as something else is handling the 404 before AdvAgg has a chance to do it. If you are reading this, it means that something else is handling the 404 before AdvAgg can. In some cases this can sometimes be a false report; go here: http://:@www.testnetwork.cu.cc/sub-folder/sites/default/files/advagg_js/js__1497524159.js and check if the source has an html comment that says "advagg_missing_fast404"; if it does, this is a false report, add this $conf['advagg_skip_404_check'] = TRUE; to your settings.php file. Raw request info:
stdClass::__set_state(array(
   'request' => 'GET /sub-folder/sites/default/files/advagg_js/js__1497524159.js HTTP/1.0
Connection: close
Referer: http://www.testnetwork.cu.cc/sub-folder/admin/reports/status
User-Agent: Drupal (+http://drupal.org/)
Host: www.testnetwork.cu.cc
Authorization: Basic Og==

',
   'data' => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /sub-folder/sites/default/files/advagg_js/js__1497524159.js was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
',
   'protocol' => 'HTTP/1.1',
   'status_message' => 'Not Found',
   'headers' => 
  array (
    'date' => 'Thu, 15 Jun 2017 10:56:01 GMT',
    'server' => 'Apache',
    'strict-transport-security' => 'max-age=63072000; includeSubDomains',
    'x-frame-options' => 'SAMEORIGIN',
    'x-content-type-options' => 'nosniff',
    'content-length' => '384',
    'connection' => 'close',
    'content-type' => 'text/html; charset=iso-8859-1',
  ),
   'code' => '404',
   'error' => 'Not Found',
))
Error
Adv CSS/JS Agg - HTTP Request	HTTP requests to advagg for css files are not getting through.
AdvAgg will issue a request for a file that does not exist inside of the AdvAgg directory. If AdvAgg sends a 404, everything is ok; if something else sends a 404 then that means that AdvAgg will not be able to generate an aggregate if it is missing as something else is handling the 404 before AdvAgg has a chance to do it. If you are reading this, it means that something else is handling the 404 before AdvAgg can. In some cases this can sometimes be a false report; go here: http://:@www.testnetwork.cu.cc/sub-folder/sites/default/files/advagg_css/css__1497524159.css and check if the source has an html comment that says "advagg_missing_fast404"; if it does, this is a false report, add this $conf['advagg_skip_404_check'] = TRUE; to your settings.php file. Raw request info:
stdClass::__set_state(array(
   'request' => 'GET /sub-folder/sites/default/files/advagg_css/css__1497524159.css HTTP/1.0
Connection: close
Referer: http://www.testnetwork.cu.cc/sub-folder/admin/reports/status
User-Agent: Drupal (+http://drupal.org/)
Host: www.testnetwork.cu.cc
Authorization: Basic Og==

',
   'data' => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /sub-folder/sites/default/files/advagg_css/css__1497524159.css was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
',
   'protocol' => 'HTTP/1.1',
   'status_message' => 'Not Found',
   'headers' => 
  array (
    'date' => 'Thu, 15 Jun 2017 10:56:01 GMT',
    'server' => 'Apache',
    'strict-transport-security' => 'max-age=63072000; includeSubDomains',
    'x-frame-options' => 'SAMEORIGIN',
    'x-content-type-options' => 'nosniff',
    'content-length' => '387',
    'connection' => 'close',
    'content-type' => 'text/html; charset=iso-8859-1',
  ),
   'code' => '404',
   'error' => 'Not Found',
))
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

C.E.A created an issue. See original summary.

mikeytown2’s picture

View the HTML source code for "advagg_missing_fast404"
https://www.computerhope.com/issues/ch000746.htm

mikeytown2’s picture

Status: Active » Needs review
FileSize
3.58 KB

I've modified the instructions by adding this "(press ctrl+u on your keyboard)". Let me know if this is still not clear, and what parts are not clear so I can give better directions.

  • mikeytown2 committed d7d771d on 7.x-2.x
    Issue #2886423 by mikeytown2: Adv CSS/JS Agg - HTTP Request in status...
C.E.A’s picture

You understand me wrong !
I know how to view the page source !!!
The error display the following:

In some cases this can sometimes be a false report; go here: http://:@www.testnetwork.cu.cc/sub-folder/sites/default/files/advagg_js/... and check if the source has an html comment that says "advagg_missing_fast404"; if it does, this is a false report, add this $conf['advagg_skip_404_check'] = TRUE; to your settings.php file. Raw request info:

However, when i go to http://:@www.testnetwork.cu.cc/sub-folder/sites/default/files/advagg_js/... , the page is not found and so i cannot check if the source has an html comment that says "advagg_missing_fast404" or no !

What should i do ?

mikeytown2’s picture

On most 404 pages you can view the source. Try on this page as an example
https://www.google.com/asdfasdfasdfasdfsdf
We want the check the source of the 404 page to see if AdvAgg generated it.

mikeytown2’s picture

Thinking I could use the w3 validator to view the source like so

https://validator.w3.org/check?uri={URL}&ss=1&No200=1#source
https://validator.w3.org/nu/?doc={URL}&checkerrorpages=yes&showsource=yes#source

If you fill in {URL} with http://...YOUR SITE.../sites/default/files/advagg_css/css__1497524159.css does advagg_missing_fast404 show up in the source section of the above pages?

Or do you get

The requested URL ...../sites/default/files/advagg_css/css__1497524159.css was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Like what AdvAgg is reporting?

C.E.A’s picture

Hi again,

to better understand what is going on please find the attached pictures:

1) I went to following page /admin/reports/status
2) The above explained error appear.
3) The error description suggest to check the following link:
http://www.testnetwork.cu.cc/tabarja-kfaryassine/sites/default/files/advagg_js/js__1497626912.js
and
http://www.testnetwork.cu.cc/tabarja-kfaryassine/sites/default/files/advagg_css/css__1497626912.css
4) After clicking on any of the above links, the following is displayed:
After clicking on the link

5) While i am on the Not found page, Hit Ctrl + u and the following is displayed:
Source Code of the first image

6) Follow the below link to find the results of w3 validator you suggested.
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.testnetwork.cu.cc%2Ftabarja-kfaryassine%2Fsites%2Fdefault%2Ffiles%2Fadvagg_js%2Fjs__1497626912.js;ss=1;No200=1

Thank you,

mikeytown2’s picture

You have a problem with your Apache configuration. This might help you out https://stackoverflow.com/questions/12760351/getting-404-not-found-error...

What's the core .htaccess look like and the one located at /tabarja-kfaryassine/sites/default/files/advagg_js/.htaccess

mikeytown2’s picture

Status: Needs review » Active
C.E.A’s picture

Hi again,

Please find below:

My core .htaccess (my-domain/.htacess):

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order allow,deny
  </IfModule>
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Override PHP settings that cannot be changed at runtime. See
# sites/default/default.settings.php and drupal_environment_initialize() in
# includes/bootstrap.inc for settings that can be changed at runtime.

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_flag magic_quotes_gpc                 off
  php_flag magic_quotes_sybase              off
  php_flag register_globals                 off
  php_flag session.auto_start               off
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_flag mbstring.encoding_translation    off
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

  <FilesMatch \.php$>
    # Do not allow PHP scripts to be cached unless they explicitly send cache
    # headers themselves. Otherwise all scripts would have to overwrite the
    # headers set by mod_expires if they want another caching behavior. This may
    # fail if an error occurs early in the bootstrap process, and it may cause
    # problems if a non-Drupal PHP file is installed in a subdirectory.
    ExpiresActive Off
  </FilesMatch>
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Set "protossl" to "s" if we were accessed via https://.  This is used later
  # if you enable "www." stripping or enforcement, in order to ensure that
  # you don't bounce between http and https.
  RewriteRule ^ - [E=protossl]
  RewriteCond %{HTTPS} on
  RewriteRule ^ - [E=protossl:s]

  # Make sure Authorization HTTP header is available to PHP
  # even when running as CGI or FastCGI.
  RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  # Block access to "hidden" directories whose names begin with a period. This
  # includes directories used by version control systems such as Subversion or
  # Git to store control files. Files whose names begin with a period, as well
  # as the control files used by CVS, are protected by the FilesMatch directive
  # above.
  #
  # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  # not possible to block access to entire directories from .htaccess, because
  # <DirectoryMatch> is not allowed here.
  #
  # If you do not have mod_rewrite installed, you should remove these
  # directories from your webroot or otherwise protect them from being
  # downloaded.
  RewriteRule "/\.|^\.(?!well-known/)" - [F]

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} .
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

  # 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 /

  # Pass all requests not referring directly to files in the filesystem to
  # index.php. Clean URLs are handled in drupal_environment_initialize().
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

  # Rules to correctly serve gzip compressed CSS and JS files.
  # Requires both mod_rewrite and mod_headers to be enabled.
  <IfModule mod_headers.c>
    # Serve gzip compressed CSS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

    # Serve gzip compressed JS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

    # Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
    RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

    <FilesMatch "(\.js\.gz|\.css\.gz)$">
      # Serve correct encoding type.
      Header set Content-Encoding gzip
      # Force proxies to cache gzipped & non-gzipped css/js files separately.
      Header append Vary Accept-Encoding
    </FilesMatch>
  </IfModule>
</IfModule>

# Add headers to all responses.
<IfModule mod_headers.c>
  # Disable content sniffing, since it's an attack vector.
  Header always set X-Content-Type-Options nosniff
</IfModule>

The /tabarja-kfaryassine/sites/default/files/advagg_js/.htaccess

Options +FollowSymLinks

<IfModule mod_rewrite.c>
  RewriteEngine on
  <IfModule mod_headers.c>
    # Serve brotli compressed JS files if they exist and the client accepts br.
    RewriteCond %{HTTP:Accept-encoding} br
    RewriteCond %{REQUEST_FILENAME}\.br -s
    RewriteRule ^(.*)\.js $1\.js\.br [QSA]
    RewriteRule \.js\.br$ - [T=application/javascript,E=no-gzip:1]

    <FilesMatch "\.js\.br$">
      # Serve correct encoding type.
      Header set Content-Encoding br
      # Force proxies to cache gzipped & non-gzipped css/js files separately.
      Header append Vary Accept-Encoding
    </FilesMatch>

    # Serve gzip compressed JS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
    RewriteRule \.js\.gz$ - [T=application/javascript,E=no-gzip:1]

    <FilesMatch "\.js\.gz$">
      # Serve correct encoding type.
      Header set Content-Encoding gzip
      # Force proxies to cache gzipped & non-gzipped css/js files separately.
      Header append Vary Accept-Encoding
    </FilesMatch>
  </IfModule>
</IfModule>

<FilesMatch "^js__[A-Za-z0-9-_]{43}__[A-Za-z0-9-_]{43}__[A-Za-z0-9-_]{43}.js(\.gz|\.br)?">
  # No mod_headers. Apache module headers is not enabled.
  <IfModule !mod_headers.c>
    # No mod_expires. Apache module expires is not enabled.
    <IfModule !mod_expires.c>
      # Use ETags.
      FileETag MTime Size
    </IfModule>
  </IfModule>

  # Use Expires Directive if apache module expires is enabled.
  <IfModule mod_expires.c>
    # Do not use ETags.
    FileETag None
    # Enable expirations.
    ExpiresActive On
    # Cache all aggregated js files for 52 weeks after access (A).
    ExpiresDefault A31449600
  </IfModule>

  # Use Headers Directive if apache module headers is enabled.
  <IfModule mod_headers.c>
    # Do not use etags for cache validation.
    Header unset ETag
    # Serve correct content type.
    Header set Content-Type application/javascript
    <IfModule !mod_expires.c>
      # Set a far future Cache-Control header to 52 weeks.
      Header set Cache-Control "max-age=31449600, no-transform, public, immutable"
    </IfModule>
    <IfModule mod_expires.c>
      Header append Cache-Control "no-transform, public, immutable"
    </IfModule>
  </IfModule>
  ForceType application/javascript
</FilesMatch>

Thank you,

mikeytown2’s picture

At the top of the
/tabarja-kfaryassine/sites/default/files/advagg_js/.htaccess
and
/tabarja-kfaryassine/sites/default/files/advagg_css/.htaccess
files but right below
Options +FollowSymLinks

Try adding this
ErrorDocument 404 /index.php

What version of Apache are you using?

JamesOakley’s picture

I'm confused. This issue is referenced in the release notes for 7.x-2.25 (as a new feature), but it's still active and nothing's been committed yet. Could someone explain how this was introduced in 7.x-2.25?

mikeytown2’s picture

Look at comment #4. The change is a documentation/wording change. Feature being better explanation.

JamesOakley’s picture

Ah - that makes sense.

Something in 7.x-2.25 broke one site I tried it on, but not the other (in that the page started to render with no CSS at all). The error I got in the site status report led me here, but if this issue is only about documenting issues then I'm in the wrong place.

I'll do some more digging to try and find out why my site stopped aggregating correctly with the new version, then open a separate issue (or update the relevant one).

C.E.A’s picture

Hi again and sorry for the late reply,

I tried adding the above given code in both of mentioned .htaccess files, but I still have the same problem (nothing changed as described above in comment #8).

below are information of my server:

Apache Version: 2.4.25
PHP Version: 5.6.30
MySQL Version: 10.0.31
Operating System: linux

mikeytown2’s picture

What happens if you remove the .htaccess file from the /advagg_css/ directory?

Steps:
Delete /tabarja-kfaryassine/sites/default/files/advagg_css/.htaccess
Check the source of http://www.testnetwork.cu.cc/tabarja-kfaryassine/sites/default/files/adv...

C.E.A’s picture

Hi again,

when i removed the .htaccess file from the /advagg_css/ directory and re-visited http://www.testnetwork.cu.cc/tabarja-kfaryassine/sites/default/files/adv...

I received the below:

Not Found

The requested URL was not found on this server.

Home

And in the status report of my site:

the Adv CSS/JS Agg - HTTP Request HTTP requests to advagg for css files are not getting through. part of error has gone away but the Adv CSS/JS Agg - HTTP Request HTTP requests to advagg for js files are not getting through. still available as shown below:

Adv CSS/JS Agg - HTTP Request	HTTP requests to advagg for js files are not getting through.
AdvAgg will issue a request for a file that does not exist inside of the AdvAgg directory. If AdvAgg sends a 404, everything is ok; if something else sends a 404 then that means that AdvAgg will not be able to generate an aggregate if it is missing as something else is handling the 404 before AdvAgg has a chance to do it. If you are reading this, it means that something else is handling the 404 before AdvAgg can. In some cases this can sometimes be a false report; go here: http://:@www.testnetwork.cu.cc/tabarja-kfaryassine/sites/default/files/advagg_js/js__1498285873.js and check if the source (press ctrl+u on your keyboard) has an html comment that says "advagg_missing_fast404"; if it does, this is a false report, add this $conf['advagg_skip_404_check'] = TRUE; to your settings.php file. Raw request info:
stdClass::__set_state(array(
   'request' => 'GET /tabarja-kfaryassine/sites/default/files/advagg_js/js__1498285873.js HTTP/1.0
Connection: close
Referer: http://www.testnetwork.cu.cc/tabarja-kfaryassine/admin/reports/status
User-Agent: Drupal (+http://drupal.org/)
Host: www.testnetwork.cu.cc
Authorization: Basic Og==

',
   'data' => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /tabarja-kfaryassine/sites/default/files/advagg_js/js__1498285873.js was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
',
   'protocol' => 'HTTP/1.1',
   'status_message' => 'Not Found',
   'headers' => 
  array (
    'date' => 'Sat, 24 Jun 2017 06:31:16 GMT',
    'server' => 'Apache',
    'strict-transport-security' => 'max-age=63072000; includeSubDomains',
    'x-frame-options' => 'SAMEORIGIN',
    'x-content-type-options' => 'nosniff',
    'content-length' => '384',
    'connection' => 'close',
    'content-type' => 'text/html; charset=iso-8859-1',
  ),
   'code' => '404',
   'error' => 'Not Found',
))

And two new errors appeared:

Adv CSS/JS Agg - Cache-Control	The cache-control's max-age header being sent by your web server is not at least 1 month in the future.
The web servers configuration should be adjusted only for AdvAgg files. Was looking that the max-age second counter is over 2,628,000 (1 month), actually got max-age=1209600. You can turn this warning off if you can not adjust this value (Pantheon) by adding this to your settings.php file: $conf['advagg_skip_far_future_check'] = TRUE;
Warning
Adv CSS/JS Agg - Expires	The expires header being sent by your web server is not at least 1 month in the future.
The web servers configuration should be adjusted only for AdvAgg files. Was looking for a second counter over 2,628,000 (1 month), actually got 1,209,603 (Sat, 08 Jul 2017 06:31:16 GMT). You can turn this warning off if you can not adjust this value (Pantheon) by adding this to your settings.php file: $conf['advagg_skip_far_future_check'] = TRUE;

Thank you,

mikeytown2’s picture

What the browser sees and what the status report says seems to be 2 different 404 messages. Can you view the source in the browser when the .htaccess file is removed?

C.E.A’s picture

While the .htaccess removed as requested above, this is my page source of http://www.testnetwork.cu.cc/tabarja-kfaryassine/sites/default/files/adv...

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /tabarja-kfaryassine/sites/default/files/advagg_js/js__1498317142.js was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
C.E.A’s picture

Hi again and thank you for the continuous support,

The website where i am having the issue is a dev.website and located under:
/home/username/public_html/testnetwork.cu.cc/[site-name.com]/

and the error mentioned above always appear whatever i tried...

However,
When i copied the same website (files, folders & DB) to the Prod.Website located under:
/home/username/public_html/[site-name.com]/

The error just gone and and all now is working good with no error at all.

In fact, the satus report of my website is now showing the following message:

Adv CSS/JS Agg OK
Advanced CSS/JS Aggregator should be working correctly.

I really don't know what happened and why on my dev.website the error still appear but on my Prod.website the error completely disappear !!!

I believe that my problem has been fixed now since i care about the prod.website more than the dev.website, but i would like to know the problem behind what is happening if you have some explanation !?

NOTE:
Both prod.website and dev.website are on the same shared-server and they are 100% identical in db, files & folders.

Thank you for your cooperation and help,

mikeytown2’s picture

Can you check the Apache configuration? website in a subdir or virtual host?

C.E.A’s picture

What do you mean by apache configuration ? could you be more specific please ?
The website with errors (Dev.website) is inside a subdir so its url is: my-domain.com/subdir
and
The website without errors (Prod.website) is inside the root folder so its url is: my-domain.com

mikeytown2’s picture

So dev and prod are on the same server, just dev is in a subdir.

On your dev box what's the value of this

echo $GLOBALS['base_path'];

If it's "/" what does

print_r($_SERVER);

output?
If it's not "/" what version of AdvAgg are you using?

C.E.A’s picture

I am using version 7.x-2.25 and only the Advanced CSS/JS Aggregation (advagg) module is enabled.

After running the drush command drush eval 'print_r($_SERVER);':

Array
(
[MANPATH] => :/usr/local/easy/share/man
[HOSTNAME] => my-host-name
[SHELL] => /bin/bash
[TERM] => xterm
[HISTSIZE] => 1000
[PERL5LIB] => /home/username/perl5/lib/perl5
[PERL_MB_OPT] => --install_base "/home/usernameperl5"

[USER] => username
[LS_COLORS] => rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
[COLUMNS] => 80
[PATH] => /usr/local/jdk/bin:/home/username/perl5/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/cpanel/composer/bin:/usr/local/easy/bin:/usr/local/bin:/usr/X11R6/bin:/home/username/bin
[MAIL] => /var/spool/mail/username
[PWD] => /home/username/www/testnetwork.cu.cc/tabarja-kfaryassine
[JAVA_HOME] => /usr/local/jdk
[EDITOR] => pico
[HISTCONTROL] => ignoredups
[HOME] => /home/username
[SHLVL] => 1
[LS_OPTIONS] => --color=tty -F -a -b -T 0
[PERL_LOCAL_LIB_ROOT] => /home/username/perl5
[LOGNAME] => username
[VISUAL] => pico
[CLASSPATH] => .:/usr/local/jdk/lib/classes.zip
[LESSOPEN] => ||/usr/bin/lesspipe.sh %s
[HISTTIMEFORMAT] => %d/%m/%y %T username[654153] 68.235.36.118 58348 184.154.61.98 22
[G_BROKEN_FILENAMES] => 1
[PERL_MM_OPT] => INSTALL_BASE=/home/username/perl5
[PHP_SELF] => /index.php
[SCRIPT_NAME] => /index.php
[SCRIPT_FILENAME] => /home/username/public_html/testnetwork.cu.cc/tabarja-kfaryassine/index.php
[PATH_TRANSLATED] => /home/username/drush/drush.php
[DOCUMENT_ROOT] =>
[REQUEST_TIME_FLOAT] => 1498510383.2332
[REQUEST_TIME] => 1498510383
[argv] => Array
(
[0] => /home/username/drush/drush.php
[1] => --php=/usr/bin/php-cli
[2] => --php-options=
[3] => eval
[4] => print_r($_SERVER);
)

[argc] => 5
[HTTP_HOST] => default
[SERVER_PORT] =>
[REQUEST_URI] => /
[REMOTE_ADDR] => 127.0.0.1
[REQUEST_METHOD] =>
[SERVER_SOFTWARE] =>
[HTTP_USER_AGENT] =>
[HTTP_REFERER] =>
[SERVER_PROTOCOL] => HTTP/1.0
)

and running the drush command drush eval 'echo $GLOBALS['base_path'];':

gives no output at all.

UPDATE:
Yes, both dev and prod are on the same server, just dev is in a subdir and both using different domain names.

Dev website:
domain-name-1.com/subdir

Prod website:
domain-name-2.com

However dev website is an exact copy of the prod website

JamesOakley’s picture

Because @mikeytown2 is suspecting the issue may be with your Apache configuration, I'm not sure you'll see much running those commands from Drush. (Drush sends them straight to PHP, and so PHP won't report your Apache environment)

Try creating a file called "test.php" in the document root that prints out those same server global variables, and then see what you get.

mikeytown2’s picture

I forgot to mention that. Create a file called test.php (or something else) and put this in it

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
header('Content-Type: text/plain');

echo $GLOBALS['base_path'] . "\n\n";
print_r($_SERVER);

If you're wondering what these lines are, the first 3 are copied out of the index.php file.

C.E.A’s picture

Hi again,

Here are my results of my codetest.php created file:

Array
(
    [PATH] => /sbin:/usr/sbin:/bin:/usr/bin
    [SCRIPT_NAME] => /tabarja-kfaryassine/codetest.php
    [REQUEST_URI] => /tabarja-kfaryassine/codetest.php
    [QUERY_STRING] => 
    [REQUEST_METHOD] => GET
    [SERVER_PROTOCOL] => HTTP/1.1
    [GATEWAY_INTERFACE] => CGI/1.1
    [REMOTE_PORT] => 59603
    [SCRIPT_FILENAME] => /home/username/public_html/testnetwork.cu.cc/tabarja-kfaryassine/codetest.php
    [SERVER_ADMIN] => webmaster@domain-name.com
    [CONTEXT_DOCUMENT_ROOT] => /home/username/public_html/testnetwork.cu.cc
    [CONTEXT_PREFIX] => 
    [REQUEST_SCHEME] => http
    [DOCUMENT_ROOT] => /home/username/public_html/testnetwork.cu.cc
    [REMOTE_ADDR] => 68.235.37.84
    [SERVER_PORT] => 80
    [SERVER_ADDR] => 184.154.61.98
    [SERVER_NAME] => www.testnetwork.cu.cc
    [SERVER_SOFTWARE] => Apache
    [SERVER_SIGNATURE] => 
    [LD_LIBRARY_PATH] => /usr/local/apache/lib
    [HTTP_COOKIE] => Drupal.tableDrag.showWeight=0; SESS6b499bd1c7ba430c69bda17697cb8424=Yy8Chn9TjhJxb-F_VYXx2GGwQx-rcdIClQ5dlQ8PCOU; SESSefbe99df372e00a1ed22c3d78308d7bb=ey7sn26OmfGpD57zG3_uldIhI9w1-qA3OE7TFPrlpFI; DrupalModuleFilter=activeTab%3Dall; _ga=GA1.2.1487000543.1498331370; _gid=GA1.2.155733563.1498331370; has_js=1
    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8,ar;q=0.6,fi;q=0.4
    [HTTP_ACCEPT_ENCODING] => gzip, deflate, sdch
    [HTTP_DNT] => 1
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_CONNECTION] => close
    [HTTP_HOST] => www.testnetwork.cu.cc
    [HTTP_AUTHORIZATION] => 
    [protossl] => 
    [UNIQUE_ID] => WVKqhLiaPWIAB5QLk00AAACN
    [FCGI_ROLE] => RESPONDER
    [PHP_SELF] => /tabarja-kfaryassine/codetest.php
    [REQUEST_TIME_FLOAT] => 1498589830.0443
    [REQUEST_TIME] => 1498589830
    [HTTP_REFERER] => 
)
mikeytown2’s picture

So $GLOBALS['base_path'] is empty; drupal_settings_initialize() should set it. That's super weird.

Can you run this?

echo 'a: ' . $GLOBALS['base_path'] . "\n\n";
$base_path = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/') . '/';
echo 'b: ' . $base_path . "\n\n";
echo 'c: ' . $GLOBALS['base_path'] . "\n\n";
C.E.A’s picture

I am receiving the following:

Notice: Undefined index: base_path in /home/username/public_html/testnetwork.cu.cc/tabarja-kfaryassine/codetest.php on line 2
a: b: /tabarja-kfaryassine/ c: /tabarja-kfaryassine/

when running:

echo 'a: ' . $GLOBALS['base_path'] . "\n\n";
$base_path = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/') . '/';
echo 'b: ' . $base_path . "\n\n";
echo 'c: ' . $GLOBALS['base_path'] . "\n\n";
mikeytown2’s picture

Status: Active » Needs review
FileSize
4.3 KB

Created a patch that will set the base_path if its not set. Looking over your drush $_SERVER and normal $_SERVER output and SCRIPT_NAME is different in that drush doesn't contain the subdir while accessing it via apache it does.

// Drush
[SCRIPT_NAME] => /index.php

// Apache
[SCRIPT_NAME] => /tabarja-kfaryassine/codetest.php

Running the advagg updates from drush if it doesn't have the correct subdir is what caused this issue most likely; the advagg .htaccess would have the wrong base_path for the ErrorDocument.

Try this patch and go to the status report page admin/reports/status. Delete the advagg_js/.htaccess and advagg_css/.htaccess files and hit the status report page again.

mikeytown2’s picture

I think calling drush like so is how to do it correctly in your case.

drush --root=/home/username/public_html/testnetwork.cu.cc/tabarja-kfaryassine/ --uri=www.testnetwork.cu.cc/tabarja-kfaryassine/

Also see https://drupal.stackexchange.com/questions/125132/drush-doesnt-detect-dr...

C.E.A’s picture

I applied your patch and delete both .htaccess files and then clean the browser and the website caches.

Now i have the below errors:

Adv CSS/JS Agg - Cache-Control	The cache-control's max-age header being sent by your web server is not at least 1 month in the future.
The web servers configuration should be adjusted only for AdvAgg files. Was looking that the max-age second counter is over 2,628,000 (1 month), actually got max-age=1209600. You can turn this warning off if you can not adjust this value (Pantheon) by adding this to your settings.php file: $conf['advagg_skip_far_future_check'] = TRUE;
Adv CSS/JS Agg - Cache-Control	The cache-control's max-age header being sent by your web server is not at least 1 month in the future.
The web servers configuration should be adjusted only for AdvAgg files. Was looking that the max-age second counter is over 2,628,000 (1 month), actually got max-age=1209600. You can turn this warning off if you can not adjust this value (Pantheon) by adding this to your settings.php file: $conf['advagg_skip_far_future_check'] = TRUE;
Adv CSS/JS Agg - Content-Type	The wrong Content-Type is being sent by your web server.
The web servers configuration will need to be adjusted. Was looking for application/javascript, actually got text/javascript. You might need to apply the drupal core patch located here https://drupal.org/node/2193333#comment-8469991.
Adv CSS/JS Agg - Expires	The expires header being sent by your web server is not at least 1 month in the future.
The web servers configuration should be adjusted only for AdvAgg files. Was looking for a second counter over 2,628,000 (1 month), actually got 1,209,603 (Thu, 13 Jul 2017 16:52:36 GMT). You can turn this warning off if you can not adjust this value (Pantheon) by adding this to your settings.php file: $conf['advagg_skip_far_future_check'] = TRUE;
Adv CSS/JS Agg - Expires	The expires header being sent by your web server is not at least 1 month in the future.
The web servers configuration should be adjusted only for AdvAgg files. Was looking for a second counter over 2,628,000 (1 month), actually got 1,209,604 (Thu, 13 Jul 2017 16:52:37 GMT). You can turn this warning off if you can not adjust this value (Pantheon) by adding this to your settings.php file: $conf['advagg_skip_far_future_check'] = TRUE;

Thank you,

  • mikeytown2 committed 8f53b41 on 7.x-2.x
    Issue #2886423 by mikeytown2: Adv CSS/JS Agg - HTTP Request in status...
mikeytown2’s picture

Status: Needs review » Fixed
FileSize
6.77 KB

This patch has been committed. Go to the AdvAgg: Operations page and press the Recreate htaccess files button.

C.E.A’s picture

I would like to confirm that applying the patch advagg-2886423-34-check-errordoc-htaccess.patchand recreared the htaccess files, all is working now !

The following patches will be included in the next release version for drupal 7 ?!

Thank you

mikeytown2’s picture

The patch in #35 is the only one that is needed and has been committed (see comment #34). It's in the dev release currently and will be apart of the 7.x-2.26 release.

C.E.A’s picture

Issue summary: View changes
webservant316’s picture

does this patch fix an actual problem or a false positive error report?

mikeytown2’s picture

This fixes an actual problem with the advagg .htaccess file's ErrorDocument 404; it can happen if the site is accessed via drush and it's a subdir site; or if you move a site from a subdir to root or root to subdir.

webservant316’s picture

I manually applied the patch to Advanced CSS/JS Aggregation 7.x-2.25, rebuilt the .htaccess files on the operations page and my problem did not go away. Still seeing the following...

Adv CSS/JS Agg - HTTP Request	HTTP requests to advagg for js files are not getting through. The .htaccess needs to be rebuilt.
The .htaccess file generated by AdvAgg has the incorrect errordoc location. This can happen if Drush is used incorrectly or if the site has been moved to a different directory structure. If you are currently using drush this is how to access it correctly:

drush --root=.../ --uri=...
Odds are you will need to fix the errordoc location. Go to the AdvAgg: Operations page and under Regenerate .htaccess files press the Recreate htaccess files button. If you wish to manually edit the file go to the sites/default/files/advagg_js/.htaccess file and make sure the following line is in there near the top and any other ErrorDocument 404 statements have been removed.

ErrorDocument 404 /index.php

So I went to manually edit the .htaccess file and the .htaccess file was not even there.

?

mikeytown2’s picture

What does this output?

print_r(variable_get('advagg_htaccess_check_generate', ADVAGG_HTACCESS_CHECK_GENERATE));
webservant316’s picture

that outputs 1. wow, I need to figure out why .htaccess is not created. there are no php errors or drupal errors.

webservant316’s picture

Oops sorry. the .htaccess file is there in there in the advagg_css and advagg_js folder. However, the line "ErrorDocument 404 /index.php" is not there as the status page warning asks. The line is NOT their because of the test below in advagg.missin.inc and my base_path== '/'.

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

So I manually added the line "ErrorDocument 404 /index.php" in advagg_js/.htaccess and advagg_css/.htaccess and it made no difference. I still get the error....

Adv CSS/JS Agg - HTTP Request	HTTP requests to advagg for js files are not getting through. The .htaccess needs to be rebuilt.
The .htaccess file generated by AdvAgg has the incorrect errordoc location. This can happen if Drush is used incorrectly or if the site has been moved to a different directory structure. If you are currently using drush this is how to access it correctly:

drush --root=.../ --uri=...
Odds are you will need to fix the errordoc location. Go to the AdvAgg: Operations page and under Regenerate .htaccess files press the Recreate htaccess files button. If you wish to manually edit the file go to the sites/default/files/advagg_js/.htaccess file and make sure the following line is in there near the top and any other ErrorDocument 404 statements have been removed.

ErrorDocument 404 /index.php

Any other ideas?

Status: Fixed » Closed (fixed)

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