对状态的响应:0对于URL:null
问题描述:
即时通讯使用离子视图传统和http后没有任何关于它的问题。但是当使用离子视图pro进行迁移时,在执行http post后显示错误“响应状态:0 for URL:null”。对状态的响应:0对于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 */
\t \t if (isset($_SERVER['HTTP_ORIGIN'])) {
\t \t \t header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
\t \t \t header('Access-Control-Allow-Credentials: true');
\t \t \t header('Access-Control-Max-Age: 86400');
\t \t }
但问题仍未解决。
答
终于...我解决了这个问题,从http更改为https并检查标题发送。来自jwt的headher是我的问题,所以我使用post not header来更改它。