showing a shiny app in html (shinyAppDir, iframe) does not work anymore after switching to https??

365 views
Skip to first unread message

Tom Geens

unread,
Feb 22, 2017, 1:11:16 PM2/22/17
to Shiny - Web Framework for R
Hi All,

I installed SSL certificates on both my shiny server and my webserver.
My application runs fine at https://bsohtools.tk/shiny/co2sim/ when accessing it directly.

Before installing the SSL certificates, I could run the application in a iframe on the website of our society: https://www.bsoh.be/?q=nl/shiny/ and in ioslides presentations from rmarkdown files.

However, after installing the certificates, it does not show up anymore on my website nor in my slides.
 

When running the app directly from rstudio server in a chrome browser using the play button with the code


```{r}
shinyAppDir("/srv/shiny-server/co2sim/")
```

and then "open in browser", the app runs like expected.

When knitting an rmarkdown to a shiny interactive document and then "open in browser" (chrome), the presentation runs, but it shows the code for shinyAppDir and a blank rectangle for the iframe. Does anybody know what is going on and why the shiny gallery https://support.rstudio.com/hc/en-us/articles/217592607-Can-I-embed-shiny-apps-in-other-websites-e-g-iFrames- eg https://shiny.rstudio.com/gallery/superzip-example.html
is full of similar examples and why I can't get this to work?

Many thanks,
Tom 




---
title: "Test"
author: "tom"
date: "22-2-2017"
output: ioslides_presentation
runtime: shiny
---

## Test

- Test

----


```{r}
library(shiny)
shinyAppDir("/srv/shiny-server/co2sim/")
```
----

<iframe src="https://bsohtools.tk/shiny/co2sim/" width="100%" height="1800px"></iframe>

----


Tom Geens

unread,
Feb 23, 2017, 4:27:01 PM2/23/17
to Shiny - Web Framework for R
Hi All,
Found the solution...

In the webserver configuration, you should set the X-Frame options to ALLOWALL in the location headers.
For me, this had to be done for the nginx, locations /shiny/ and /rstudio/.

After adding

add_header X-Frame-Options ALLOWALL;

as the last line in both sections, the application loaded fine in iframes and html5 presentations.
Kind regards,
Tom.


 

Op woensdag 22 februari 2017 19:11:16 UTC+1 schreef Tom Geens:
Reply all
Reply to author
Forward
0 new messages