# discourseEmbed, does not match recipient window origin

**URL:** https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737
**Category:** Support
**Created:** [February 21, 2017, 8:08pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737 "2017-02-21T20:08:31Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![trudat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/trudat/32/104354_2.png) [@trudat](https://meta.discourse.org/u/trudat)
#### Post date: [February 21, 2017, 8:08pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/1 "2017-02-21T20:08:31Z")

</div>

I am trying to embed Discourse comments into an external site, and getting a CORS-like error in the console of the external site. It is a CKAN site using a 3rd party plugin for Discourse integration ([plugin link](https://github.com/ontodia/ckanext-discourse)). Both sites are served over HTTPS.

The Discourse iFrame loads on the external site, there’s a message “Loading Discussion…” that tries to load comments. It reloads the iFrame about every 10 seconds, in a loop.

The error in CKAN console:

```
Failed to execute 'postMessage' on 'DOMWindow': The target 
origin provided ('https://discourse-site') does not match the  
recipient window's origin ('https://ckan-site').

```

In the Discourse error log:

`Job exception: SSL_connect returned=1 errno=0 state=error: certificate verify failed`

By opening the `env` tab, i get the following details.

```
hostname	forum-app
process_id	[97, 101, 3295, 7109, 174, 98, 104]
application_version	[ae671355da1db07dedd4a1c927282ce7ce8ecc33, 476ae57af300b6a052318f66a1c84d3e791c0d26, ce7c3bfc14c873b952bb4242d2d2b9ac5ae466d6]
current_db	default
current_hostname	discourse-site.com
job	Jobs::RetrieveTopic
problem_db	default
opts	null
user_id	3
embed_url	[https://ckan-site/dataset/test-003, https://ckan-site/dataset/test-06]
referer	[https://ckan-site/dataset/test-003, https://ckan-site/dataset/test-06, https://discourse-site/embed/comments?embed_url=https%3A%2F%2Fckan-site%2Fdataset%2Ftest-003, https://discourse-site/embed/comments?embed_url=https%3A%2F%2Fckan-site%2Fdataset%2Ftest-06]
current_site_id	default

```

###Related posts

> [@\[solved\] Error Embedding](https://meta.discourse.org/t/solved-error-embedding/57276):
>
> Hi, similar to [this post](https://meta.discourse.org/t/403-error-embedding-comments/42923), I’m getting errors embedding comments in a static site: [https://bigsmall.io/articles/action-brands-are-important-urgent-credible/](https://bigsmall.io/articles/action-brands-are-important-urgent-credible/) In the browser console, I it says “Loading Discussion”, then “Error Embedding” with this in the JavaScript console: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://community.bigsmall.io') does not match the recipient window's origin ('https://bigsmall.io'). The topics are created in Discourse - I see t…

> [@How can I troubleshoot Discourse comments embedding feature?](https://meta.discourse.org/t/how-can-i-troubleshoot-discourse-comments-embedding-feature/30323/4):
>
> @purldator here are my embed settings (sorry, I can’t embed images or link to them): embeddable hosts: [ddhstaging.satapps.org](http://ddhstaging.satapps.org) feed polling enabled: {unchecked} feed polling url: {blank} embed by username: ddhdatasets embed username key from feed: {blank} embed category: Data Discovery Hub Datasets embed post limit: 100 embed truncate: {unchecked} embed whitelist selector: {blank} embed blacklist selector: {blank} My site is a data catalog based on CKAN , pages are generated from templates.…

[https://meta.discourse.org/t/403-error-embedding-comments/42923](https://meta.discourse.org/t/403-error-embedding-comments/42923)

> [@Embed Discourse comments on another website via Javascript](https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963):
>
> Discourse has the ability to embed the comments from a topic in a remote site using a Javascript API that creates an IFRAME. For an example of this in action, check out [Coding Horror’s blog](http://blog.codinghorror.com/welcome-to-the-internet-of-compromised-things/#discourse-comments). The blog is run via [Ghost](https://ghost.org/) but the comments are embedded from his [Discourse forum](http://discourse.codinghorror.com/t/welcome-to-the-internet-of-compromised-things/3550). One important thing to note with this setup is that users have to navigate to your forum to post replies. This is intentional, as we feel that the posting interface on a Discourse forum is currently much richer than what we …

---

<div class="post-metadata">

### Author: ![trudat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/trudat/32/104354_2.png) [@trudat](https://meta.discourse.org/u/trudat)
#### Post date: [March 16, 2017, 1:58am UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/2 "2017-03-16T01:58:56Z")

</div>

This is the Ruby log during the attempted pairing by CKAN extension.

```
Started GET "/embed/comments?embed_url=https%3A%2F%2Fmydomain.ca%2Fdataset%2Ftest-number-08" for 192.222.209.126 at 2017-03-16 01:16:34 +0000
Processing by EmbedController#comments as HTML
  Parameters: {"embed_url"=>"https://mydomain.ca/dataset/test-number-08"}
  Rendered embed/embed_error.html.erb within layouts/embed (1.9ms)
Completed 200 OK in 11ms (Views: 6.1ms | ActiveRecord: 1.3ms)
Started GET "/push-service-worker.js" for 192.222.209.126 at 2017-03-16 01:16:35 +0000
Processing by DiscoursePushNotifications::ServiceWorkerController#push as */*
  Rendered plugins/discourse-push-notifications/assets/javascripts/push-service-worker.js (0.0ms)
Completed 200 OK in 5ms (Views: 0.5ms | ActiveRecord: 0.8ms)
Started GET "/latest.json?_=1489619147351" for 192.222.209.126 at 2017-03-16 01:16:52 +0000
Processing by ListController#latest as JSON
  Parameters: {"_"=>"1489619147351"}
Completed 200 OK in 75ms (Views: 0.1ms | ActiveRecord: 19.3ms)
Started GET "/categories_and_latest?_=1489619147352" for 192.222.209.126 at 2017-03-16 01:16:54 +0000
Processing by CategoriesController#categories_and_latest as JSON
  Parameters: {"_"=>"1489619147352"}
Completed 200 OK in 94ms (Views: 0.2ms | ActiveRecord: 17.2ms)
Started GET "/c/datasets/l/latest.json?_=1489619147353" for 192.222.209.126 at 2017-03-16 01:16:59 +0000
Processing by ListController#category_latest as JSON
  Parameters: {"_"=>"1489619147353", "category"=>"datasets"}
Completed 200 OK in 54ms (Views: 0.2ms | ActiveRecord: 23.2ms)
Job exception: SSL_connect returned=1 errno=0 state=error: certificate verify failed

Job exception: SSL_connect returned=1 errno=0 state=error: certificate verify failed

```

---

<div class="post-metadata">

### Author: ![ebadgley](https://avatars.discourse-cdn.com/v4/letter/e/e19b73/32.png) [@ebadgley](https://meta.discourse.org/u/ebadgley)
#### Post date: [March 16, 2017, 4:39pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/3 "2017-03-16T16:39:03Z")

</div>

@trudat, is looks like you are getting a SSL\_connect error - are all your SSL certificates in order?

The only way I was able to resolve that aspect was switching to a different test server with all the certificates in order, at which point the SSL issue went away. I’m still having issues with embedding, but everything now looks OK on the Ruby side so there is something else going on with me.

---

<div class="post-metadata">

### Author: ![trudat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/trudat/32/104354_2.png) [@trudat](https://meta.discourse.org/u/trudat)
#### Post date: [March 16, 2017, 4:42pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/4 "2017-03-16T16:42:45Z")

</div>

That’s what i’m working on now. The SSL diagnostic returned the two issues below. I’m trying to get the cert chain order figured out, but SSL is confusing. I have the .crt and .key files, not sure exactly what putting them in order means, or what the right test sequence would be.

- This server’s certificate chain is incomplete. Grade capped to B.
- This server accepts RC4 cipher, but only with older browsers. Grade capped to B.

---

<div class="post-metadata">

### Author: ![trudat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/trudat/32/104354_2.png) [@trudat](https://meta.discourse.org/u/trudat)
#### Post date: [March 16, 2017, 4:58pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/5 "2017-03-16T16:58:44Z")

</div>

After days of banging my head against this, I have just fixed the SSL issue on the CKAN host which was the cause of the error `Job exception: SSL_connect returned=1 errno=0 state=error: certificate verify failed`.

Dozens of pages were consulted, but re-generating the SSL chain cert at this site [https://certificatechain.io/](https://certificatechain.io/) and restarting NGINX finally fixed it.

> <https://stackoverflow.com/questions/25109349/nginx-not-serving-intermediate-certificate>

---

<div class="post-metadata">

### Author: ![ebadgley](https://avatars.discourse-cdn.com/v4/letter/e/e19b73/32.png) [@ebadgley](https://meta.discourse.org/u/ebadgley)
#### Post date: [March 16, 2017, 5:02pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/6 "2017-03-16T17:02:14Z")

</div>

Glad to hear it - in my case since it’s all a test environment it was easier to switch to something with known “good” certificates.

Did this fix your embedding issue?

---

<div class="post-metadata">

### Author: ![trudat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/trudat/32/104354_2.png) [@trudat](https://meta.discourse.org/u/trudat)
#### Post date: [March 16, 2017, 5:09pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/7 "2017-03-16T17:09:33Z")

</div>

After the SSL was fixed, the embedding provided by this extension for the [CKAN](http://ckan.org) data platform started to work beautifully. I don’t want to say how long i’ve been trying to get this working, let’s just say this made my week.

[https://github.com/OpenGov-OpenData/ckanext-discourse](https://github.com/OpenGov-OpenData/ckanext-discourse)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 14, 2019, 10:25pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/8 "2019-05-14T22:25:06Z")

</div>



---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 14, 2019, 11:29pm UTC](https://meta.discourse.org/t/discourseembed-does-not-match-recipient-window-origin/57737/9 "2019-05-14T23:29:04Z")

</div>


