×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Problems loading comments

Problems loading comments 10 years 11 months ago #24603

  • Simon Arthur
  • Simon Arthur's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
On my website, the comments aren't loading correctly.
You can see the problem here:
www.bigbluesaw.com/saw/faqs/information-...-blue-saw-offer.html
When there are no comments, things work fine:
www.bigbluesaw.com/saw/faqs/information-...terials/leather.html
What should I be looking at to fix this? I tried disabling Artio JoomSEF for CComment.

Problems loading comments 10 years 11 months ago #24606

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Since when do you have the issue?
I see that the comments are making an OPTIONS request to the server instead of GET. Something has changed the request type. Have you installed anything lately? Any system plugins?

Problems loading comments 10 years 11 months ago #24612

  • Simon Arthur
  • Simon Arthur's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
Daniel: thanks for looking into this. I'm not sure how long this has been happening. I have been installing extensions fairly regularly for a while now.

I did a little research into this based on your response. Apparently, the OPTIONS request is sent whenever the data request comes from Javascript code that is not served from the same origin as the JavaScript is served from.
More info:
metajack.im/2010/01/19/crossdomain-ajax-...p-binding-made-easy/
stackoverflow.com/questions/1256593/jque...ead-of-a-get-request

A couple other things I noticed:
The OPTIONS request will always be made to www.bigbluesaw.com , no matter the request's original page. This means that if I try to bypass Cloudflare by using the hostname directly, it still tries www.bigbluesaw.com .

A shorter page for easier testing:
www.bigbluesaw.com/saw/faqs/parts/what-k...th-big-blue-saw.html

Problems loading comments 10 years 11 months ago #24613

  • Simon Arthur
  • Simon Arthur's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
Yet another thing: it actually works correctly if you use HTTPS to get the original page:
www.bigbluesaw.com/saw/faqs/parts/what-k...th-big-blue-saw.html

So I think if we can just force CComment to use the same protocol that the page was requested with, everything should work fine.

Problems loading comments 10 years 11 months ago #24634

  • Simon Arthur
  • Simon Arthur's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
Any ideas on this?

Problems loading comments 10 years 11 months ago #24638

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Simon,
Thanks for the investigation. When you look at the source code of the page you'll notice that we initialize some config vars for ccomment. One of those is the baseURL:
baseUrl: ' www.bigbluesaw.com/ ',
As you can see the base url is set to https. Now we use a standard joomla function here Juri::root() -> this function should return http for the http version and https for the https version. Why it returns https in your case on the http domain is beyond me.
Here are few ideas:
1. Do you use any SEF component?
2. Any plugin that could modify that?
3. Look at configuration.php -> do you have a $live_site variable there set to the https version of your site?

Regards,
Daniel

Problems loading comments 10 years 11 months ago #24643

  • Simon Arthur
  • Simon Arthur's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
1. Artio JoomSef, which is disabled for this component.
2. None that I'm aware of.
3. # grep live_site *
configuration.php: public $live_site = ' www.bigbluesaw.com ';
This was set because without it, a bunch of other stuff breaks, including the admin backend and Mijoshop.
Also, if this is the source of the problem, if we switched it to http then the https version of the website wouldn't work.

Problems loading comments 10 years 11 months ago #24644

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Simon,
My suspicion is that JoomSef is the issue. It might be disabled for the component, but it is messing around with the Juri::root function.
Is it possible to disable the component and see if the problem persist?

I know how we could fix this - with template override and there you could set the url yourself. But let us first find out if it is JoomSef or not.

regards,
Daniel

Problems loading comments 10 years 11 months ago #24645

  • Simon Arthur
  • Simon Arthur's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
I disabled the main Joomla SEF option as well as JoomSEF and retried it. Still did not work.

Problems loading comments 10 years 11 months ago #24646

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Simon,
I'm sure that you have something on your site that modifies the Juri::base() function. Most probably a plugin. Anyway. Here is the workaround:
components\com_comment\templates\default\default.php line 89 has:
			baseUrl: '" . JUri::base() . "',
change it to:
			baseUrl: '//www.bigbluesaw.com/',

We are fixing the url in the template. Whenever you are on http -> it will use the http, whenever you are on https, it will use the https address.
You can of course use a template override and that way you won't have to do the same change every time you update the comment system.

cheers,
Daniel

P.S. I'm sure that what's causing this is a template or a component on your site. It would be nice if we could find which one it is. So if you have the time to turn off some plugins, it would be cool and you would help other people find out what is causing this. thanks!

Problems loading comments 10 years 10 months ago #24796

  • Simon Arthur
  • Simon Arthur's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 17
  • Thank you received: 0
After some tracing and debugging, I'm pretty sure that JUri::root and JUri::base will always give the Joomla configured URL when calling those functions, rather than the actual accessed URL. For creating URLs for images, download files, and links, this is fine. However, for any Javascript which may access a server side resource, this will cause the problem seen here.

Have a look at this code from Joomla's uri.php:
public static function base($pathonly = false)
	{
		// Get the base request path.
		if (empty(self::$base))
		{
			$config = JFactory::getConfig();
			$live_site = $config->get('live_site');

The first time this function is called, it sets up the base request path by getting Joomla's configuration, not by looking at the request URL. Thus, if the client requests the page from a different URL than what the configuration has been set to (like if the site is accessible from both HTTP and HTTPS), the JUri::base() will be different from the client requested protocol and/or host.

There are two places which need to be changed to support this. One is in default.php as you mentioned before. I found a different technique which should be more general though.
baseUrl: '" . ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/' . "',

Also, utils.php needs to be changed in a similar fashion on line 312:
			'baseUrl' => ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/'

I would like to continue getting updates as needed. Can you explain what you mean by a "template override"?
  • Page:
  • 1
Time to create page: 0.124 seconds