问题
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".
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" />
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');
}
but problem still not solved.
回答1:
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.
来源:https://stackoverflow.com/questions/46397111/respon-with-status-0-for-url-null