R Shiny-如何添加访问控制允许来源:* [英] R Shiny - how to add Access-Control-Allow-Origin: *

查看:195
本文介绍了R Shiny-如何添加访问控制允许来源:*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Access-Control-Allow-Origin: *添加到有光泽的应用程序?

How can I add Access-Control-Allow-Origin: * to a Shiny app?

我想通过以下ajax调用Shiny应用程序:

I want to call the Shiny app via ajax below:

<div id='include-from-outside'></div>
<script type='text/javascript'>
    $.get('//127.0.1.1:3838/', {}, function(data, status, xhr) {
        var updatedData = data.replace(/\/(images|stylesheets|javascripts|vendors|fonts)+/g, "http://127.0.1.1:3838/$1");

        $('#include-from-outside').html(updatedData);
    });
</script>

但是我得到这个错误:

请求的请求上没有'Access-Control-Allow-Origin'标头 资源.因此,不允许访问来源" http://127.0.1.1 ".

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.1.1' is therefore not allowed access.

有什么想法吗?

推荐答案

我遇到了同样的问题.

简单的方法是只在Google chrome中添加扩展名,以允许使用CORS进行访问.

The easy way is to just add the extension in google chrome to allow access using CORS.

( https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=zh-CN )

只要您想允许不访问任何"access-control-allow-origin"标头请求,就只需启用此扩展名.

Just enable this extension whenever you want allow access to no 'access-control-allow-origin' header request.

这篇关于R Shiny-如何添加访问控制允许来源:*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆