Some pages on my site won't fully embed comments

I have set up an embedding using the JS snippet, linking a project documentation site (driven by Sphinx & Read The Docs) to our forum to allow people to comment there on each document.

Overall, the embedding is working – many pages on the site are working fine. But a few (apparently) random pages don’t work at all. The IFRAME appears, as does the site’s logo, but it hangs saying "Loading Discussion..."

The associated topic for these pages with the error is not being created, too. It’s unclear why some pages would fully work and some wouldn’t. The pages that work, do work fine, create the topic excerpt correctly in Discourse, show existing comments from the associated topic, etc.

Does anyone have ideas on how best to troubleshoot this? (I can provide example pages if someone is curious to dive deeper.) Thanks!

Any errors in the browser’s F12 JS console?

Yes, but only within the IFRAME itself, and only on the pages that don’t render the content fully. (In other words, this does not appear when the comments render successfully on the same site.)

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('') does not match the recipient window's origin ('').

postUp @ comments?
window.onload @ comments?

You have a mismatch in the allowed URLs there per the error message.

Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘’) does not match the recipient window’s origin (‘’).

That would make sense, but does not seem to explain why some .html pages on the same site work and some do not.

We can actually change foo.html (the real page filename) to bar.html in the value of discourseEmbedUrl and it works. :thinking:

Are those pages redirecting to some other URL?

Maybe make the request and watch the network tab in your browser’s f12 console.

Nope, no HTTP redirection involved, unfortunately.

  • Regardless of whether we set the value of discourseEmbedUrl to either the dymanic URL using window.location.href, or just hard code the actual URL, we get the same error as above.

  • If we hard code the value of discourseEmbedUrl to an existing .html page on the same site that already has an associated topic, things load fine.

  • If we hard code the value of discourseEmbedUrl to a non-existing .html page on the same site that does not have any associated topic already, we also get the same error.

We are hoping to get a look at our rails log to see if we can see what might be happening (or not) on the back end. Will update here when we learn more.

Just so I am clear:

Are no new topics ever being created anymore, or are they still only being created for random URLs? Is there any rhyme or reason to the URLs that don’t work?

You’ll definitely want to take a look at the Rails logs. It’s possible sidekiq is having problems reaching the destination for some reason. It is necessary that your server can reach the page.


New topics are being created – not just for random URL’s but most any URL except a few problematic ones.

Nothing that we’ve found yet. In fact, we can, on the same page, change the URL that we’re passing the embed.js script, and it works. So it doesn’t seem to be anything on the page itself that’s causing the problem.

Yeah, we think this is the logical next steps. Waiting to hear back from the hosting folks on coordinating this troubleshooting. :wink:

Page access seems unlikely since they’re simply different *.html pages on the same site that we’re working with, but it’s possible, I suppose.

Apologies but I didn’t realize you meant on our hosting :slight_smile:

We can actually check our error logs for this - can you tell us the last time you saw the problem happen? Otherwise it’s going to be tricky to discover. The exact URL of the embed would be useful too.


Hey there. So I was looking again at this site – hadn’t done so yet this week – and noticed that the pages in question started creating topics as of 2 days ago. Not sure how or why this happened, but suffice to say cannot repro this issue anymore!

Thanks to all for your brainpower nevertheless. :slight_smile: