响应状态:0表示URL:null [英] Respon with status: 0 for URL: null

查看:367
本文介绍了响应状态:0表示URL:null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用离子视图遗产和http帖子没有任何问题。但在使用离子视图pro进行http post时进行迁移然后显示错误响应状态:0表示URL:null

im using ionic view legacy and the http post don't have any problem about it. but when migrating using ionic view pro when doing http post then show error "Respon with status: 0 for URL: null".

这是我的config.xml的一部分

This is a part of my 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所以在后端我只需添加:

this problem because of CORS so at back end i just add :

/* 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');
		}

但问题仍未解决。

推荐答案

最后......我通过从http更改为https并检查标题发送来解决此问题。来自jwt的headher是我的问题,所以我使用post not header更改它。

Finally… i solve this problem with change from http to https and check header send. Headher from jwt is my problem, so i change it using post not header.

这篇关于响应状态:0表示URL:null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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