【问题标题】:Cordova 5.4.0 404 not found (from cache) whitelist CORS http POST requestCordova 5.4.0 404 未找到(来自缓存)白名单 CORS http POST 请求
【发布时间】:2015-11-13 09:33:15
【问题描述】:

我刚刚使用最后一个 Cordova 工具更新了我的 Visual Studio 2015。 我将 Cordova 更新到 5.4.0 并尝试使用 cordova-android 4.1.1 和 5.0.0

我的错误是当我尝试向我的网络服务 (CORS) 发出发布请求时:

http://ws.MyService.be/PostBug.axd

这是我的 Android 设备上的响应:

Request URL:http://ws.MyService.be/PostBug.axd
Request Method:POST
Status Code:404 Not Found (from cache)
Response Headers
Client-Via:shouldInterceptRequest
Request Headers
Provisional headers are shown
Accept:application/json, text/plain, */*
Cache-Control:no-store, no-cache, must-revalidate
Content-Type:application/json
Origin:file://
User-Agent:Mozilla/5.0 (Linux; Android 5.0; SM-G900F Build/LRX21T; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/46.0.2490.76 Mobile Safari/537.36

在 config.xml 中:

<access origin="*" />
<allow-navigation href="http://*.infotec.be/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

在 index.html 中:

<meta http-equiv="Content-Security-Policy" content="default-src 'self' http://ws.MyService.be http://www.infotec.be https://push.ionic.io data: gap: maps.googleapis.com maps.gstatic.com https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *;script-src 'self' 'unsafe-eval' 'unsafe-inline';">

cordova-plugin-whitelist 安装的是 1.0.0 版本

我不知道如何解决这个问题。 我只是试着做一个

cordova platform update android@4.X.X

但即使使用 android 4.1.1 我也会收到此错误 代码和服务没有改变,只有科尔多瓦的版本和所有的改变。并且 Visual Studio 已更新

编辑:

我可以通过邮递员访问该服务。

我刚刚更新到 cordova-plugin-whitelist 1.1.1-dev。

重建我的应用程序后,我现在对所有 http 请求都有 net::ERR_CACHE_MISS 并且都是(失败)状态...没有 HTTP 响应(正文或​​标头)

【问题讨论】:

  • 您可以通过其他方式访问该服务吗?您的服务器是否需要刷新缓存?我想知道这是否与服务器缓存有关,然后是您的 Cordova 更新。
  • @SteveKennedy 我更新了我的答案。我可以通过邮递员访问服务,并且该服务获取发布数据以将其插入数据库。所以没有缓存
  • @Jerome2606 我也有同样的问题。降级到 Crodova 5.3.3 似乎并没有解决这个问题。您是否也降级了 Cordova Android?

标签: android cordova visual-studio-2015 visual-studio-cordova


【解决方案1】:

Cordova 5.4 与 Visual Studio 和 Windows 存在许多问题和不兼容性。我建议回滚到 5.3,直到 Cordova 社区发布适用于 Windows 场景的版本。

当我们发布更新时,我们通常会修改我们在 Visual Studio 中定位的默认 Cordova 版本,但由于这些问题,我们将跳过 5.4。

(披露:我在微软的 Visual Studio 中为 Apache Cordova 开发工具)

【讨论】:

  • 感谢您的评论。我开始使用 Cordova 5.3.3,一切正常。即使我使用 remotebuild 使其在 Android 和 IOS 上也能正常工作
  • 我有同样的错误。我回滚到 5.3.3 但问题仍然存在。有什么想法吗?
猜你喜欢
  • 2021-04-20
  • 1970-01-01
  • 2016-10-11
  • 2020-07-21
  • 1970-01-01
  • 2015-07-14
  • 2018-09-09
  • 1970-01-01
相关资源
最近更新 更多