I have an RShiny app with hyperlinks pointing to external websites. The app is hosted on shinyapps with a paid subscription allowing custom domains. When I access the app via the custom domain the external hyperlinks have stopped working (page returns: "refused to connect"). However, when I run the exact same app via the native shinyapps url the hyperlinks in the app work properly. For mimimal reproducible example see the following and click the BTO hyperlink:
I'm not 100% confident about this, but I think I may have some pointers.
From what I tested, the issue is with rendering the https://www.bto.org/ URL inside the http://data.bto.org/testarea/ app. By inside, I mean just left-clicking. If you open the link in a new tab it will work ok.
So, my guess is that the https://www.bto.org/ site might have some firewall rules to avoid non-secure sites (i.e., http instead of https) to display its content.
I imagine three possible solutions (from better to worst, in my opinion)
Have a secure protocol for your custom domain (i.e. get it to be https://data.bto.org/testarea/)
Add target="_blank" attribute to the <a> tag (i.e., the hyperlink that reads "BTO" in the app) to automatically open the https://www.bto.org/ site on a new tab.
Change the firewall configuration to stop refusing the non-secure site (if that's even the case )
Hope this helps
Cheers!
This post was published by an Appsilon team member. Our company can help you get the most out of RShiny and Posit/RStudio products.
Thanks for your suggestions. Option 2 is the only option I think may work in short term. I am sure the app in question (not the demo) has been functioning correctly for several weeks and I do not know what has suddenly changed.
Option 1 is not possible as you cannot have https protocols for custom domains (as per Shiny documentation.
Option 3, I will check about the firewall. But this issue affects most of the external links I have in my app which formerly worked, and I doubt everyone just changed their firewall settings.
Re. option 1, you may find this workaround useful (however, as they correctly point there, it has its drawbacks). In fact, it seems that the shinyapps custom domain feature is just about that (embedding the app as an iframe)
Re. option 3, I see now that the hyperlinks were working some time ago, but not now. So, if this correlates with some unlikely change in the firewall settings for https://www.bto.org/, this would explain the issue.
Hope this helps
Cheers!
This post was published by an Appsilon team member. Our company can help you get the most out of RShiny and Posit/RStudio products.