加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – 访问chrome net :: ERR_INSECURE_RESPONSE中的loca

发布时间:2020-12-17 07:08:10 所属栏目:安全 来源:网络整理
导读:我试图使用angular $resourses访问在localhost中运行的api,chrome console给出了错误说ERR_INSECURE_RESPONSE. 我尝试在Chrome中禁用网络安全性.还是一样的错误.这是我使用的角度工厂.如何绕过此错误并测试我的应用. ImpactPortal.factory('apiFactory',func
我试图使用angular $resourses访问在localhost中运行的api,chrome console给出了错误说ERR_INSECURE_RESPONSE.

我尝试在Chrome中禁用网络安全性.还是一样的错误.这是我使用的角度工厂.如何绕过此错误并测试我的应用.

ImpactPortal.factory('apiFactory',function ($resource) {
    return $resource('https://localhost:8443/mifosng-provider/api/v1/client_impact_portal',{},{
        query: {
            method: 'GET',params: {},isArray: true
        }
    })
});

解决方法

您必须先进行身份验证,然后将每个请求与身份验证令牌一起发送.

我正在使用RestAngular,因此我的设置可能与您正在处理的内容略有不同.

这将在您的应用程序配置中进行: –

RestangularProvider.setDefaultHeaders({ 'X-Mifos-Platform-TenantId': 'default' });

这样的东西会进入你的控制器/服务

var login = Restangular.all('authentication?username=mifos&password=password').post().then(function(user) {
   console.log(user);
 },function() {
  console.log("There was an error saving");
 });

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读