Not found when embedding


#1

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:

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 :frowning:

Thanks


#2

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


#3

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… :frowning:


(Jeff Atwood) #4

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


#5

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.


(Robin Ward) #6

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


(Robin Ward) #7