TOPIC: HTTPS instead of HTTP in URLs of the cached pages

HTTPS instead of HTTP in URLs of the cached pages 02 Feb 2014 17:30 #531

Hi,

I'm very happy with JotCache. I use it with the recent Joomla 2.5 with HTTP in the fronted and HTTPS in the backend (Force SSL in the global configuration is set to "Administrator Only").

The Problem with HTTPS:
The URLs of cached pages and inside of them begin with HTTPS instead of HTTP. Furthermore the URLs of JavaScript and CSS sources begin also with HTTPS instead of HTTP. As the result of this behavior the message "The site's security certificate is not trusted!" appears in frontend or the pages are displayed plain with no JavaScript and CSS. Of course the visitors get very scared and leave my webpage immediately.

When I set Force SSL in the global configuration to "None" the problem disappears and the URLs cached pages begin with HTTP.

Is it possible to have "Force SSL" set to "Administrator Only" and tell the JotCache to save the URLs of cached Pages with HTTP only?
If not, is there some other solution to have HTTPS enabled of the backend and HTTP only in the frontend?

Thank you very much in advance.

Joomla version : 2.5
JotCache version : 4.0.4
site template:
system plugins :
The administrator has disabled public write access.

Re: HTTPS instead of HTTP in URLs of the cached pages 03 Feb 2014 04:34 #533

JotCache is not storing absolute page URL but only page content for cache retrieval. Included resources (js, css, images, etc.) can have relative or absolute URL depending on specific processing and settings (components, modules, SEF, etc.).

Entire mechanism of assigning to http or https mode is done in core Joomla.

Here are some workarounds how to force page presentation with requested absolute URL :

1. setting $live_site parameter in configuration.php file located in Joomla root

2. forcing http mode in .htaccess file when URL path does not contain /administrator/ substring

Note : JotCache is not caching backend files only frontend ones.
The administrator has disabled public write access.

Re: HTTPS instead of HTTP in URLs of the cached pages 03 Feb 2014 14:11 #538

Hi,

thank you for the fast reply.

Now I know, that JotCache does not cause the problem. The problem was the HTML-Tag BASE in my Joomla-Template. So I have solved it by:

1. removing the HTML-Tag BASE from index.php of my Joomla-template

2. replacing HTTP with HTTPS in the URLs of CDNs (Content Delivery Network) for jQuery, jQueryUI and reCaptcha and other libraries.

Now all works fine with both HTTP and HTTPS. So I have updated the coding-rules in my company accordingly.

Details to the solution.
The problem was this snippet in the index.php of the Joomla-Template:
<base href="<?php echo $doc->getBase(); ?>" />

So when somebody called my website using HTTPS and accepted the certificate, the website was cached with
<base href="https://...." />
.

And what then happened you see from my previous post.

For the website to work well with both HTTP and HTTPS it is also important to use HTTPS for CDNs. Otherwise they will not be loaded if HTTPS is used.

Greets
Juri Sinitson

Joomla version : 2.5
JotCache version : 4.0.4
site template:
system plugins :
The administrator has disabled public write access.

Re: HTTPS instead of HTTP in URLs of the cached pages 26 Feb 2017 07:48 #1887

Although this topic is old, I thought it would be beneficial to anyone reading this that, as Juri mentioned, the problem is not with the JotCache component but with the way linked resources are generated in Joomla. Modern browsers block mixed content over the https protocol. They don't allow non-secure content to be loaded into a secure page. For a background read the article Dealing with SSL mixed content in Joomla!

Joomla, unfortunately is the main culprit here by inserting a base tag which could safely be removed. It's pretty easy to do it by hacking the core, but safer to unset the tag in your template so the changes don't get wiped out on an upgrade. As suggested here, add the code at the top of your template code which is normally located at templates/[template name]/index.php
The administrator has disabled public write access.
Time to create page: 0.300 seconds
We have 50 guests and no members online
Copyright © 2015 JotComponents
We have 50 guests and no members online
Copyright © 2018 JotComponents