简体   繁体   English

访问外部站点会给出带有角度$ resource的“混合内容”错误

[英]accessing external site gives “mixed content” error with angular $resource

my server is running over https, but I need to be able to access a resource on an external site (that I have no control over) that is only available via http 我的服务器通过https运行,但是我需要能够访问只能通过http访问的外部站点上的资源(我无法控制)

I've used the user $resource setup 我使用了用户$ resource设置

        var tableDefintion = $resource('http://www.externalsite.org/xx/info.php',
        {
            param: '@data'
        }

but, obviously, when I make a resource request I get the dreaded "Mixed Content" message and it will not load 但是,显然,当我发出资源请求时,我收到了可怕的“混合内容”消息,并且该消息不会加载

I have tried adding $sceDelegateProvider.resourceUrlWhitelist to the angular config function, but that has made no difference, even when set to ['**'] 我试过将$ sceDelegateProvider.resourceUrlWhitelist添加到angular配置函数中,但是即使设置为['**'] ,也没有什么区别

This resource is being used from within a service - is there anything else I can do to get round this issue ? 服务内部正在使用此资源-我还能采取其他措施来解决此问题吗?

thanks 谢谢

If you are trying to do this by getting the client (browser) to do this request then there is no way round this ( MDN ) as it's a security risk. 如果您试图通过让客户端(浏览器)执行此请求来执行此操作,则此方法( MDN无法解决,因为它存在安全风险。 However if you have a server why not proxy the request via your server so you can do the TLS termination yourself? 但是,如果您有服务器,为什么不通过服务器代理请求,以便自己进行TLS终止?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM