Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to best move fb-comments from http to https

We are in the process of moving a Ruby On Rails website from HTTP to HTTPS. Our sites uses the fb-comments plugin to capture user comments on various pages. During our testing we found when we switch a page from HTTP to HTTPS Facebook seems to see this as a new page and no longer loads any of the previous comments for the page.

In other words, http://my.domain.com/page1 and https://my.domain.com/page1 are treated as separate pages with different sets of comments by fb-comments.

Here's a snippet of our HTML that includes the current call to fb-comments:

<div class="fb-comments"
     data-href="<%=url_for(:only_path=>false)%>"
     data-num-posts="<%=number_of_posts%>"
     data-width="<%=width%>">
</div>

Does any know the correct way to get Facebook to return the comments for the page regardless of the protocol (HTTP vs. HTTPS)?

like image 900
Doug Couvillion Avatar asked Sep 28 '22 01:09

Doug Couvillion


2 Answers

According to my testing you need to remove 'http://' and 'https://' from fb-comments, so I use this block:

<div class="fb-comments" data-href="www.mydomain.com/page1.html"></div>
like image 169
Henrik R. Avatar answered Oct 07 '22 23:10

Henrik R.


The only way to keep the comments afaik is to use the http URL in the data-href parameter. I don´t think there are any downsides to this.

like image 1
andyrandy Avatar answered Oct 08 '22 00:10

andyrandy