如何从Cordova休息呼叫中删除Origin标题? [英] How to remove the Origin header from Cordova rest calls?

查看:241
本文介绍了如何从Cordova休息呼叫中删除Origin标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cordova应用程式传送 file:// 为Origin标头。

Cordova app sends file:// as Origin header.

当然,从文件系统加载,这种行为不是太惊讶。

Of course, since the app is being loaded from the filesystem, this behavior is not too surprising.

但是,我们的后端正确拒绝了这个原点。请参见示例: https://github.com/playframework/playframework/issues/5193

However, our backend correctly refuses this origin. See for example: https://github.com/playframework/playframework/issues/5193

这个答案建议Cordova应用程式不要传送 file:// 原始标题,这将正常工作:

This answer suggests that Cordova apps should not be sending the file:// Origin header, which would work correctly:


跨域策略不适用于PhoneGap(由于各种原因,基本上是因为您的应用程序实际上是在文件:// URI on device上运行的)。

Cross-domain policy does not apply to PhoneGap (for a variety of reasons, basically because your app is essentially running off the file:// URI on-device).

我们使用白名单插件,但这不会阻止 Origin:file://

We are using the whitelist plugin, but that does not prevent the Origin: file:// header from being sent to the server.

如果Cordova没有发送 Origin header。

It would be ideal for us if Cordova just didn't send the Origin header at all. Can it be configured this way?

推荐答案

如果不太晚,您可以随时切换到 https://github.com/wymsee/cordova-HTTP

If it's not too late, you could always switch to https://github.com/wymsee/cordova-HTTP.

这篇关于如何从Cordova休息呼叫中删除Origin标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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