I recently transitioned my site from HTTP to HTTPS; all Discourse threads link to their original posts at http://sitename.com/posts/[post number], and with redirects in place it still works great for browsers.
However, we’re seeing some duplicate threads show up somewhat randomly, with original posts linking back to HTTPS links for posts on the homepage. As an example, for a thread created in ~2014 originating from http://sitename.com/posts/243, there’s now a new thread with no replies created, linking back to https://sitename.com/posts/243. I had written the discourseEmbedUrl as http://sitename.com to avoid the system mistakenly creating duplicate threads, but it still seems to do it randomly.
The code I’m using on the template page is here (with substitutions made):
The variables discourseUrl and discourseEmbedUrl differ in HTTP/HTTPS approach because I did not want Discourse to view a post as “new” and re-create it, because of simply being accessed over HTTPS instead of over HTTP. Since browsers get redirected from HTTP to HTTPS, it’s worked thus far except for having random duplicates.
Has anyone else had this issue before? I had thought specifying http://sitename.com instead of https://sitename.com would be clear enough to avoid this issue so Discourse would see there is already a thread created for the post in question, but something seems to be going wrong still.
Is there a different approach I should take so that there aren’t random duplicate threads created?