Hi guys,

I've had boost running on my site for well over a year, without too many issues. Recently I noticed a bunch on missing images in pages,
(see an example here ... http://www.lightflows.co.uk/projects/web-design/wildlife-aid)
It seems that the cause of the missing imagse is that the image path is prefixed with HTTPS and not HTTP.

I don't run an SSL cert on this domain and never have - I have no clue why boost is adding HTTPS to the image path. When i'm logged in as admin and the cache is ignored, the images display fine as the path is just the usual HTTP.

An one experienced this?

CommentFileSizeAuthor
#15 boost_https-1066220_15.patch3.11 KBfrankcarey

Comments

mikeytown2’s picture

https://www.lightflows.co.uk/projects/web-design/wildlife-aid works (if you accept the self signed cert) thus it got cached. There is a setting to not cache https. Do a ctrl-f on the boost settings page to find it. You will need to flush your sites cache most likely.

hixster’s picture

Thanks MikeyTown - seems like there some hosting weirdness going on, as we don't have an SSL cert. I'll disable the caching for HTTPS like you suggest though, many thanks.

hixster’s picture

Hi Mikeytown, I have searched the config page and can't see any options for HTTPS? Would they be in another version of the module?

hixster’s picture

Update:

Can't see the setting in the config page, but can see some setting in the .htaccess generation page:

Should I change the RewriteCond %{HTTPS} on to OFF?

 # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
  RewriteCond %{REMOTE_ADDR} ^213\.246\.100\.18$ [OR]
  RewriteCond %{HTTP:Pragma} no-cache [OR]
  RewriteCond %{HTTP:Cache-Control} no-cache [OR]
  RewriteCond %{HTTPS} on
  RewriteRule .* - [S=3]
mikeytown2’s picture

Category: support » bug

Leave this to on.
RewriteCond %{HTTPS} on
Looks like I got my self a bug. Need to not cache https

hixster’s picture

o.k. thanks for letting me know - any quick work arounds? my site is periodically broken?

mikeytown2’s picture

Statically cache specific pages:
select "Cache pages for which the following PHP code returns TRUE (PHP-mode, experts only)."

global $base_root;
if ($base_root == 'https') {
  return FALSE;
}
else {
  return TRUE;
}
hixster’s picture

Nice one ,i'll give it a try.

Thanks

major_tom’s picture

Not working for me.

I added this to the config but Boost is still saving xml and html to the cache when files are first requested over https.

This badly breaks my site! We actually do have an ssl cert and we allow all pages to be requested over https or http.

hixster’s picture

Yes - I should have confirmed that the suggested PHP did not fix the issue - my images still remained broken.
Sorry for the delay in updating - we've been super busy. I've disabled boost entirely for the moment until I have more time to look into the problem more deeply.

mikeytown2’s picture

Try this

$is_https_page = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'));

if ($is_https_page) {
  return FALSE;
}
else {
  return TRUE;
}
major_tom’s picture

you know, the more I think about it, it seems like the https version should be considered a different, also-cacheable page.

for example, the regular front page could be cached in cache/normal/[domain]/_.html
and the secure front page could be cached in cache/normal/https_[domain]/_.html

and the module would do this by default (and offer an option for opting out of https cache altogether).

I may tackle this if I can get any sleep this week.

major_tom’s picture

#11 confirmed to work

Iheartdrupal’s picture

Has this bug been fixed in dev version? Should I install that?

Thank you so much for making this software, it's really cool.

frankcarey’s picture

Issue tags: +https
StatusFileSize
new3.11 KB

Here is a patch against 6.x-1.18 that adds an option to turn on and off caching HTTPS requests. FYI - It hasn't been fully tested yet.

syntheticMedia’s picture

What is the status on this? I am experiencing the same issues. Please advise, thanks!

syntheticMedia’s picture

Hate to be a pain, but can anyone please let us know what the status is? this causes some pretty serious problems on our end with a highly trafficked site and i cannot rely on an untested patch. Please advise! Thanks!!

bgm’s picture

Version: 6.x-1.18 » 6.x-1.x-dev
Status: Active » Needs review

@ everything27 : Testing the patch in #15 will help getting this committed/reviewed, but you can also use the solution in #11, i.e. to add the PHP snippet in your boost configuration ("cache if the php code returns true").

The patch in #15 seems good, but are the changes to the htaccess necessary?

William Aubert’s picture

Version: 6.x-1.x-dev » 6.x-1.21

Hello,

I have the same problem on my site. Randomly, many images on views have a prefix https that prevents their display.
All images are available with http and I don't understand what causes the appearance of this https.
I have 6.x-1.21 version and I can't apply the #15 patch for 6.x-1.18 version.
I can't no more use the solution in #11 because I already use the "Cache every page except the listed pages" option on several url:
admin/*
uc_ajax_cart
uc_ajax_cart/*
cart
cart/*
checkout
checkout/*

Can someone help me?

Anonymous’s picture

What is your .htaccess and is your site accessible by https ? As mentioned above, boost should disable.

William Aubert’s picture

The site is not accessible by https.

My .htaccess is :

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
  Order allow,deny
</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

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
  # There is no end quote below, for compatibility with Apache 1.3.
  ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
  php_value memory_limit 128M
</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

  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

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

  # 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/...)
  # adapt and uncomment the following:
RewriteCond %{HTTP_HOST} ^france-natation\.com$ [NC]
RewriteRule ^(.*)$ http://www.france-natation.com/$1 [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 and adapt the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [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 /t1
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /
    ### BOOST START ###

  # Gzip Cookie Test
  RewriteRule ^(.*)boost-gzip-cookie-test\.html cache/perm/boost-gzip-cookie-test\.html\.gz [L,T=text/html,E=no-gzip:1]

  # GZIP - Cached css & js files
  RewriteCond %{HTTP_COOKIE} !(boost-gzip)
  RewriteCond %{HTTP:Accept-encoding} !gzip
  RewriteRule .* - [S=2]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz [L,QSA,T=text/css,E=no-gzip:1]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz [L,QSA,T=text/javascript,E=no-gzip:1]

  # NORMAL - Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP:Pragma} no-cache [OR]
  RewriteCond %{HTTP:Cache-Control} no-cache [OR]
  RewriteCond %{HTTPS} on [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID
  RewriteRule .* - [S=5]

  # GZIP
  RewriteCond %{HTTP_COOKIE} !(boost-gzip)
  RewriteCond %{HTTP:Accept-encoding} !gzip
  RewriteRule .* - [S=2]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html,E=no-gzip:1]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz [L,T=text/xml,E=no-gzip:1]

  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=text/xml]

  ### BOOST END ###


  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
SetEnv REGISTER_GLOBALS 0
SetEnv ZEND_OPTIMIZER 1
SetEnv MAGIC_QUOTES 0
SetEnv PHP_VER 5
</IfModule>
Anonymous’s picture

How odd. Can you turn off boost and visit those pages and see if the url's are constructed with https ? as boost should only save the output. Also do you you have a base_url set in settings.php (in an unrelated issue it was found that some sites needed this).

Anonymous’s picture

are you talking about https://www.jouet-bois.com/jeu/nenufable because it is accessible by a self signed certificate.

William Aubert’s picture

There is nothing special in my settings.php.

In fact, when I refreshed all caches (those boost included) or when I disabled boost, the images appear again with http.
The problem does not occur all the time. Looks like it occurs after changes have been made on nodes.

William Aubert’s picture

It is www.france-natation.com but they are built and hosted in the same way

Anonymous’s picture

I have looked at the other site (same self signed certificate).

What is was thinking was setting the base_url to only http may solve the problem, your pages can be requested via https which if boost is not disabling correctly would create a page with references to https images, you might be being spidered. I'd like to fix the bug but I'm more concerned with getting you running firstly.

The rewrite rules are working correctly, an https requested page is not being served as boost'ed which does suggest that it's the PHP of the module.

Anonymous’s picture

A quick way around this would be adding this to .htaccess

RewriteCond %{HTTPS} on
RewriteRule ^.*$ http://www.example.com

which would also put your missing images back (I think). Probably needs to go at the top straight after RewriteEngine

William Aubert’s picture

Thanks Philip,

Now, the https is disabled.
https://www.france-natation.com
Should I do something else in particular?

Anonymous’s picture

I think it would be preferable to put the .htaccess code in because at the moment if the PHP decides to create a https link then you will have nothing display whereas with the rewrite then you will have images.

It's more of a, when we find the time to have a look at the drupal 6 code which is 'minimally maintained'.

Add the code.
Just clear the cache out.

William Aubert’s picture

Thanks Philip,

sorry I would not make mistakes.
So I add :
RewriteCond %{HTTPS} on
RewriteRule ^.*$ http://www.france-natation.com

But should I remove the line : RewriteCond %{HTTPS} on [OR]
in my .htaccess ?

Anonymous’s picture

Just leave the other line in. It is telling apache not to server cache pages over an SSL connection but is not the source of the problem and later on if we debug it, then you might need that line in there.

Put the rewrite code in, then visit the https version of the site and it should immediately redirect you. IF you are still getting missing images later on after the cache is cleared then we need to investigate at a higher priority. I suspect that your site is being crawled using https:// by a spider and generating boost pages with https:// links which are then being used for your normal site. That code is designed to get rid of that issue and if it continues then we have more information to work with, without the need to go through your server logs.

William Aubert’s picture

Ahhhh. Ok, now I understand.
Thank you very much for these explanations.
I implemented the code and cleared cache.
I will tell you if the problem occurs again.

bgm’s picture

Status: Needs review » Fixed

Closing issue, re-open if necessary.

Status: Fixed » Closed (fixed)

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

giorgio79’s picture