How to disable websocket on Shiny?

吃可爱长大的小学妹 提交于 2021-02-07 09:59:47

问题


I have a Shiny application in a Docker container hosted on Microsoft Azure WebApp. The application doesn't work anymore when log in with Azure Active Directory is activated.

The application page is accessible but a error 500 is returned on websocket content as shown on the Firefox network trace. This error is not present without log in with AAD.

I've tried adding the following options to /etc/shiny-server/shiny-server.conf:

sanitize_errors off;
disable_protocols websocket xdr-polling;

This did not solve the issue, the network trace are unchanged. How can I force Shiny not to use websocket?


回答1:


EDIT:

With the new version of Azure App Services this problem was solved. My solution below is NOT needed any more!

Upgrading to the latest Shiny and its underlying httpuv library (>= 1.5.2) is also recommended which solves some related problems (see https://community.rstudio.com/t/shiny-v1-3-known-regressions-and-serious-issues/28180).

Before I had to solve the problem described here How do I get Shiny-server to working with Azure Active Directory

Original answer (now deprecated for resolving the issue with Azure App Services):

I had the same problem with Shiny: The browser can't load Websocket content when Azure Active Directory (AD) Authentication is enabled. The websocket call got HTTP 101 ("Switching protocols"). But its working when AD Authentication is disabled, so seems like the problem source is the Azure Proxy doing the authentication (e.g. it inserts some HTTP headers). I solved the problem via disable_protocols websocket xdr-polling; in the Shiny server config.




回答2:


You can´t. R Shiny is actually built on top of websockets and runs an R Process. Without websockets, reactivity in Shiny would not be possible.

Read here: https://community.rstudio.com/t/is-there-any-equivalent-of-web-sockets-in-shiny-world/17908



来源:https://stackoverflow.com/questions/54892445/how-to-disable-websocket-on-shiny

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!