Discourse not shown in iframe


(Dreadkopp) #1

Aloha Communtiy, i am trying to put discourse in an iframe since i don’t have free wildcards at my dyndny hoster.

I run my main apache server at port 80 and the docker containing discourse redirects to port 82.

the page i am talking about is here: http://archy.no-ip.org/forum/

instead of the discourse page at http://archy.no-ip.org:81 it just shows the blank container.

i first thought that it might be a problem with iframe to shown pages which don’t use port 80 or 443 but since another test shows that my plone-environment at port 81 (http://archy.no-ip.org/iframe-test-different-port/) is shown correctly that cannot be it.

Any ideas what’s wrong?

thanks and greetings


How to add forum search results to Wordpress search
(Jesse Perry) #2

I wouldn’t plan on it happening.


(Dreadkopp) #3

But why isn’t it working? can there be done anything else to integrate it into the website?


(Jeff Atwood) #4

We do not support running in an iframe.


Cross-Origin Framing
X-Frame Origin Embed Error
(Jens Maier) #5

Discourse (actually Rails) sends a X-Frame-Options header that tells browsers that the site does not wish to be embedded in an iframe, hence all modern browsers will simply render a white square. You can see this in e.g. Chrome’s dev console which says

Refused to display 'http://archy.no-ip.org:82/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

The only way to “fix” this is to hack Discourse yourself: move the EmbedController's before_filter and ensure_embeddable method into the main ApplicationController and set the embeddable host site setting. But, while it can be done, you’ll be on extremely unsupported terrain…


Support embedding Discourse in an iframe
Support embedding Discourse in an iframe
(Dreadkopp) #6

thanks a lot! i thought it would be pretty to have it in an iframe.

will look if i can dig in the code to remove this X-Frame-Options header.

since then i will just use a link.

Many thanks for your reply!


(xiasummer) #7

I don’t think this is a good answer, we need to know how to support. You can say not supporting now, and the probability solution is …


(Mittineague) #8

That post was made before the probability [sic possible] solution was provided in the next post made by elberet


(DD) #9

Just need to add below points inside env Tag, & it will help in fixing issue Xframe option with sameorigin. works for me. :grinning:

env:
UNICORN_WORKERS: 4
DISCOURSE_ENABLE_CORS: true**
DISCOURSE_CORS_ORIGIN: ‘*’


(Kai Middleton) #10

I’m able to load Discourse in an iframe … on Firefox. But not Chrome (or Safari). In Chrome I have the following problem: Nothing is clickable! If I open the inspector and drill into the source it will highlight various elements (e.g. rows), but neither right clicks nor left clicks on any content of iframe have an effect. Any suggestions?