2017-09-25 70 views
0

即時通訊使用離子視圖傳統和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 }

但問題仍未解決。

回答

0

終於...我解決了這個問題,從http更改爲https並檢查標題發送。來自jwt的headher是我的問題,所以我使用post not header來更改它。