By Philippa Costigan on Monday, 17 July 2017
Posted in General Issues
Likes 0
Views 512
Votes 0
Hi there,

I'm currently setting up EasyBlog on our site which runs wholly under HTTPS.

We have the Related Posts enabled to display at the bottom of blog posts but they are generating a Mixed Content warning in the browser due the post thumnbails all being called in via HTTP:


<a href="/the-new-sane-blog/leave-work-early-staying-back-may-be-unproductive" class="eb-related-thumb" style="background-image: url('http://dev.sane.org/images/easyblog_images/143/b2ap3_thumbnail_41b3e1c9a72563adbb791550ecdbe3a5_XL.jpg') !important;"></a>


It can be viewed here:

https://dev.sane.org/the-new-sane-blog/mens-mental-health-how-to-seek-help

The whole image url is being called in to the template with the following:


<?php echo $related->postimage;?>


Is it possible to force EasyBlog to server everything over HTTPS, or worst case scenario is there a file I can modify to have this image served over HTTPS?

Thanks
Hi Philippa,

You can customize the file:
.../components/com_easyblog/views/entry/view.html.php
on line 123
locate the code:

$relatedPost->postimage = $relatedPost->getImage('thumbnail', true, true);

to

$relatedPost->postimage = $relatedPost->getImage('thumbnail', true, false);


and in the file:
.../components/com_easyblog/themes/wireframe/blogs/entry/default.php
on line 227 locate the code:

<a href="<?php echo $related->getPermalink();?>" class="eb-related-thumb" style="background-image: url('<?php echo $related->postimage;?>') !important;"></a>

to

<a href="<?php echo $related->getPermalink();?>" class="eb-related-thumb" style="background-image: url ('<?php echo 'https:'. $related->postimage;?>') !important;"></a>

and see how it goes?

You're suggested to backup the file that you want to customize beforehand for precaution
·
Monday, 17 July 2017 12:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the quick reply. That almost worked but a syntax error in your code for:

/components/com_easyblog/themes/wireframe/blogs/entry/default.php

Was causing it to display an "invalid" property error. I updated it as follows to get it working:


<a href="<?php echo $related->getPermalink();?>" class="eb-related-thumb" style="background-image: url('https:<?php echo $related->postimage;?>') !important;"></a>


So obviously the changes to the "views" file will get written over with the next EasyBlog update, so I've made a note of the changes, which is fine.

But can I ask if this will be fixed in a future version of EasyBlog without having to hack core files?

Thanks
·
Monday, 17 July 2017 15:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry for the syntax error given earlier.
But can I ask if this will be fixed in a future version of EasyBlog without having to hack core files?

->Perhaps, you can create a new ticket under feature request so our developers can keep track
·
Monday, 17 July 2017 17:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks, will do - HTTPS is becoming very common so it would make sense.
·
Monday, 17 July 2017 19:17
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Philippa

HTTPS is becoming very common so it would make sense.

-> Yes, you got point there

As for now I will lock and mark this thread as resolved.

As a gentle reminder, kindly start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiry.

Have a nice day ahead
·
Monday, 17 July 2017 19:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Philippa,

Our developers just consult with me just now, actually we do not hardcoded the https into the image url as it will always referring to your site's protocol.
For further check on this, can you provide us with your the back end and FTP access to your site so our developer can check on this issue further?

Thanks for your cooperation Philippa
·
Tuesday, 22 August 2017 12:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

This seems a very strange response given it's been acknowledged in the last 24 hours by another Stack Ideas team member in the Feature Request I lodged a couple of weeks ago.

It has in fact, been acknowledge as a problem - please see this thread:

https://stackideas.com/forums/easyblog-https-support-in-all-areas

Thanks

Philippa
·
Tuesday, 22 August 2017 12:59
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Philippa,

Yes, seems like this issue has been acknowledge as a problem as developer further checking on it.
For further check on this, can you provide us with your the back end and FTP access to your site so our developer can check on this issue further?

You can add the information needed by edit your first post in the Details section or you can just include your site's access once at http://stackideas.com/dashboard/site rather than needing to keep adding them in your replies
·
Tuesday, 22 August 2017 13:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Fadhli,

I've added the details for our development server under the Site Details section.

Philippa
·
Tuesday, 22 August 2017 15:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Philippa,

This issue is not a bug within EasyBlog. The real issue here is that, when calling Joomla JURI library to return your site scheme (protocol), JURI always return http. It seems like somehow your server env is still treating as HTTP request. To fix your issue, I've added below code in your htaccess at line 760 ~ 762 and now everything is working correctly without the previous hack.


<IfModule mod_env.c>
SetEnv HTTPS on
</IfModule>


Also, I've revert the hacks from your EB /components/com_easyblog/views/entry/view.html.php and also the theme override file at /templates/uber/html/com_easyblog/blogs/entry/default.php

Hope this help and have a nice day
Sam
·
Tuesday, 22 August 2017 16:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Sam,

The issue is probably that we're running this site at Rackspace with 2 dedicated servers set up in a master/slave relationship but with a load balancer handling all of the queries between the two servers, so the forced HTTPS redirection is handled through htaccess.

If we set Joomla to run under HTTPS it just generates infinite redirect errors with this server configuration, hence why JURI always returns a HTTP request.

As far as your changes go, I'll have to do some fairly solid testing to make sure the htaccess change is ok before I roll it out on to our production server.

So while I accept your explanation, I still have a bit of a problem with all of this....

Why does it only affect the images in the Related Blogs module. For example, the main blog post images don't have the same problem - are they not using a call to JURI to load the image?

And likewise, the images on the Blog Category and Frontpage views display without any problems.

Thanks

Philippa
·
Tuesday, 22 August 2017 16:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Philippa,

Why does it only affect the images in the Related Blogs module. For example, the main blog post images don't have the same problem - are they not using a call to JURI to load the image?

And likewise, the images on the Blog Category and Frontpage views display without any problems.


The reason behind these is because in related posts section, we are using css background to display the images. Please see http://screen.stackideas.com/Coping_with_shocking_news_events_-_The_SANE_Blog_2017-08-22_16-43-25.png

Whereas, the images in other areas are using <img> tag and with the image src that are pointing to a source that are without any protocol. Please see http://take.ms/GlbrdD

CSS background only allow full url (together with the protocol) thus this is why this happen only to related posts.

Hope this help.
Sam
·
Tuesday, 22 August 2017 16:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Sam,

Hmm, I'm not sure about that explanation... I write CSS with background images all the time and I'm not required to use absolute paths with a fully qualified url.


background-image: url("/path/to/image/image.jpg");


... works just fine without a fully qualified domain name in front of it.

So I can only imagine you have some other reason for including the domain name in the code.

Regards

Philippa
·
Tuesday, 22 August 2017 17:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Philippa,

So I can only imagine you have some other reason for including the domain name in the code.


That is correctly. Another reason why we are using full url is that in some Joomla environment, when sef enabled, and if user are using relative path in their image when writing post, the Joomla sef plugin will not process the relative image path when using the image as css background. Imagine below situation,

path/to/image/hello.jpg

By right, when sef enabled in Joomla, Joomla sef plugin will convert the above into:

/path/to/image/hello.jpg

However, we've received complaints from our customers where the relative path is not process correctly. As the result, to avoid these kind of issue happen in the future, we decided to use full image url in css background.

Hope this help
Sam
·
Tuesday, 22 August 2017 17:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Sam,

That makes perfect sense for someone inserting an image in to a post but that's not the case here.

The path to the image is being created programmatically by the software so there's no reason for the full url. You could just as easily generate the path without it.

Anyway, haven't time to get in a back and forth about it but I think it's unnecessary in modules like this.

Thanks

Phlippa
·
Tuesday, 22 August 2017 17:21
·
0 Likes
·
0 Votes
·
0 Comments
·
With the exception of people who don't specify a "cover" image I guess and it just takes the first image in the post....

I guess that makes sense
·
Tuesday, 22 August 2017 17:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Phlippa,

With the exception of people who don't specify a "cover" image I guess and it just takes the first image in the post....


Yeap, that is correct
Sam
·
Tuesday, 22 August 2017 17:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Sam,

I just wanted to say a big thank you for the htaccess solution you came up with. After testing it thoroughly on our development server we've rolled it out to production and it has in fact fixed a small issue with another component we are using.

So thanks again for your efforts.

Regards

Philippa
·
Wednesday, 30 August 2017 12:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Glad to hear your issue has resolved Philippa

As a gentle reminder, kindly start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiry. I will lock and mark this thread as resolved.

Have a nice day ahead
·
Wednesday, 30 August 2017 12:41
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post