# Not found when embedding

**URL:** https://meta.discourse.org/t/not-found-when-embedding/40179
**Category:** Support
**Created:** [February 25, 2016, 7:10pm UTC](https://meta.discourse.org/t/not-found-when-embedding/40179 "2016-02-25T19:10:14Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ajimix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ajimix/32/121522_2.png) [@ajimix](https://meta.discourse.org/u/ajimix)
#### Post date: [February 25, 2016, 7:10pm UTC](https://meta.discourse.org/t/not-found-when-embedding/40179/1 "2016-02-25T19:10:14Z")

</div>

Hello,

I just did a clean install of Discourse and tried to embed it into a page. I followed all the steps in the setup instructions and managed to get the discourse site appear embed in the site (the discourse is configured to be private, logged in only) so if I’m logged out, I see the “Please login message” so embedding works. However when I login in discourse I get a 403 error in the browser console.  
Taking a log into rails logs I can see this:

```plaintext
Started GET "/embed/comments?embed_url=https%3A%2F%2Fwww.xxxxxxxxxxxx.com%2Fpages%2Ftest" for 111.111.111.111 at 2016-02-25 18:56:37 +0000
Processing by EmbedController#comments as HTML
  Parameters: {"embed_url"=>"https://www.xxxxxxxxxxxx.com/pages/test"}
  Rendered exceptions/not_found.html.erb within layouts/application (12.7ms)
  Rendered layouts/_head.html.erb (0.3ms)
  Rendered common/_special_font_face.html.erb (0.5ms)
  Rendered common/_discourse_stylesheet.html.erb (0.4ms)
  Rendered application/_header.html.erb (0.2ms)
  Rendered common/_discourse_javascript.html.erb (1.2ms)
  Rendered text template (0.0ms)
Completed 403 Forbidden in 60ms (Views: 0.5ms | ActiveRecord: 29.2ms)

```

Why is this happening? Again being logged out the embed works but logged in it doesn’t.  
If I make the discourse public (so available even for logged out) then it doesn’t work ever ☹

Thanks

---

<div class="post-metadata">

### Author: ![ajimix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ajimix/32/121522_2.png) [@ajimix](https://meta.discourse.org/u/ajimix)
#### Post date: [February 26, 2016, 6:09am UTC](https://meta.discourse.org/t/not-found-when-embedding/40179/2 "2016-02-26T06:09:33Z")

</div>

Any idea @eviltrout ? I can’t manage to get it working

---

<div class="post-metadata">

### Author: ![ajimix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ajimix/32/121522_2.png) [@ajimix](https://meta.discourse.org/u/ajimix)
#### Post date: [February 26, 2016, 7:47am UTC](https://meta.discourse.org/t/not-found-when-embedding/40179/3 "2016-02-26T07:47:00Z")

</div>

So the problem was that I needed to add www to the host… So many waster hours trying to debug that and was just www missing… ☹

---

<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: [February 26, 2016, 9:29am UTC](https://meta.discourse.org/t/not-found-when-embedding/40179/4 "2016-02-26T09:29:22Z")

</div>

Sorry about that 😢 can you clarify exactly which setting and where?

---

<div class="post-metadata">

### Author: ![ajimix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ajimix/32/121522_2.png) [@ajimix](https://meta.discourse.org/u/ajimix)
#### Post date: [February 26, 2016, 9:37am UTC](https://meta.discourse.org/t/not-found-when-embedding/40179/5 "2016-02-26T09:37:35Z")

</div>

Yes, when you add a host that should be able to embed (Customize =\> Embedding =\> Allowed Hosts) you need to include the www in the host address but not the http (it get’s removed). The weird thing is that it was working in logged out but not logged in.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [February 26, 2016, 5:20pm UTC](https://meta.discourse.org/t/not-found-when-embedding/40179/6 "2016-02-26T17:20:32Z")

</div>

I have no idea how it worked without `www` while not logged in, but the full host including `www` is definitely required for embedding.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [February 26, 2016, 8:00pm UTC](https://meta.discourse.org/t/not-found-when-embedding/40179/7 "2016-02-26T20:00:59Z")

</div>


