hyperlinks not working in app with custom domain

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:

HYPERLINK WORKS = testapp
HYPERLINK DOES NOT WORK = http://data.bto.org/testarea/

Any suggestions why this different behaviour and how to rectify?

thanks

Simon Gillings

Hi Simon!

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)

  1. Have a secure protocol for your custom domain (i.e. get it to be https://data.bto.org/testarea/)
  2. 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.
  3. Change the firewall configuration to stop refusing the non-secure site (if that's even the case :sweat_smile: )

Hope this helps :slight_smile:
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.

Check our open positions here.

Appsilon: Building impactful RShiny Dashboards and providing R coding services.
Appsilon_GIFsmall_whitebg

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.

thanks

Simon

Hi Simon :wave:

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 :slight_smile:
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.

Check our open positions here.

Appsilon: Building impactful RShiny Dashboards and providing R coding services.
Appsilon_GIFsmall_whitebg

I clicked the link and it worked for me ...
update: it works in Edge Browser; and fails in Chrome Browser

Refused to display 'https://www.bto.org/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.