Angularjs 跨源请求在使用HTTP时失败

Angularjs 跨源请求在使用HTTP时失败,angularjs,jboss,cors,cross-domain,wildfly,Angularjs,Jboss,Cors,Cross Domain,Wildfly,在我的AngularJs应用程序中,当Angular进入rest接口(使用chrome和IE11)时,我得到一个跨原点错误 您在chrome控制台中看到的内容: XMLHttpRequest cannot load localhost:9080/user/api/whoami. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https

在我的AngularJs应用程序中,当Angular进入rest接口(使用chrome和IE11)时,我得到一个跨原点错误

您在chrome控制台中看到的内容:

XMLHttpRequest cannot load localhost:9080/user/api/whoami. 
 Cross origin requests are only supported for protocol schemes: 
 http, data, chrome, chrome-extension, https, chrome-extension-resource. 

在服务器端,rest接口使用camel实现:

restConfiguration()
    .enableCORS(true)
    .corsHeaderProperty("Access-Control-Allow-Headers", "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers")
    .corsHeaderProperty("Access-Control-Allow-Origin","*")
    .component("servlet")
    .bindingMode(RestBindingMode.json)
    .dataFormatProperty("prettyPrint", "true");
这里已经提出了这个问题,但总是处理本地加载的文件

使用本地应用程序服务器Jboss(9080) 对于前端,使用角度传感器(8080)
我甚至不明白为什么存在跨源请求

应用程序无法连接到名为localhost的地址,因此错误消息显示

跨源请求仅支持协议方案:http


将界面更改为http://localhost。。。一切都很好

您是否尝试使用CORS Chrome Extension@Zooli thx,在安装扩展后,我仍然存在相同的问题,因此它应该位于前端。附加:只有当接口设置为localhost时,才会出现此问题。它在devServer上运行良好