How to remove the Origin header from Cordova rest calls?

若如初见. 提交于 2020-01-02 05:41:06

问题


Cordova app sends file:// as Origin header.

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

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

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

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).

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

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


回答1:


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



来源:https://stackoverflow.com/questions/39713671/how-to-remove-the-origin-header-from-cordova-rest-calls

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!