【问题标题】:Respon with status: 0 for URL: null响应状态:0 对于 URL:null
【发布时间】:2023-03-11 17:54:01
【问题描述】:

我使用 ionic view legacy 和 http post 没有任何问题。但是在进行 http post 时使用 ionic view pro 进行迁移时会显示错误“Respon with status: 0 for URL: null”。

这是我的 config.xml 的一部分

    <access origin="*" subdomain="true" />
    <allow-navigation href="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
   
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
    <plugin name="cordova-plugin-statusbar" spec="2.2.2" />
    <plugin name="cordova-plugin-device" spec="1.1.4" />
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
    <plugin name="cordova-plugin-ionic" spec="^1.1.9">
        <variable name="APP_ID" value="-" />
        <variable name="CHANNEL_NAME" value="Master" />
        <variable name="UPDATE_METHOD" value="auto" />
    </plugin>
    <plugin name="cordova-plugin-whitelist" spec="^1.3.1" />

这个问题是因为 CORS 所以在后端我只是添加:

/* Allow from any origin */
		if (isset($_SERVER['HTTP_ORIGIN'])) {
			header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
			header('Access-Control-Allow-Credentials: true');
			header('Access-Control-Max-Age: 86400');
		}

但问题仍未解决。

【问题讨论】:

    标签: ionic-framework ionic2 ionic3 ionic-view


    【解决方案1】:

    最后……我通过从 http 更改为 https 并检查标头发送来解决这个问题。来自 jwt 的标题是我的问题,所以我使用帖子而不是标题来更改它。

    【讨论】:

      猜你喜欢
      • 2018-08-16
      • 2017-01-24
      • 2017-11-08
      • 1970-01-01
      • 2018-06-11
      • 2017-07-06
      • 2017-10-29
      • 1970-01-01
      • 2018-10-13
      相关资源
      最近更新 更多