2013-05-19 66 views
4

我在Django應用程序的頂部有一個ExtJS應用程序,我需要發佈到/accounts/logout/以使會話無效,然後重定向到/帶SSL的ExtJS和Ajax(https)

下面的代碼在本地運行,但在具有SSL的實時站點上失敗。我在通過ExtJS進行Ajax POST時遇到了問題。代碼如下:

Ext.Ajax.request({ 
    url: '/accounts/logout/', 
    withCredentials: true, 
    method: 'POST', 
    success: function() { 
     console.log('successfully logged out'); 
     window.location.href='/' 
    } 
}); 

在Chrome瀏覽器響應狀態是(cancelled)如本屏幕截圖: enter image description here

另外我會在控制檯級別這樣的警告:

頁在https://domain.example.com/http://console.pharmacy.com.mt/顯示不安全內容 。

我是否錯過了上面Ext.Ajax請求的一些配置對象?

+0

和'http'去'https'請求?如果是這樣,那會使其成爲跨域請求。 –

+0

@EvanTrimboli單頁應用程序通過'https'呈現並提供服務;在我的情況下,任何'http'請求都會通過Nginx Web服務器重定向到它的'https'版本。所以它應該從'https'到'https'。 –

+0

我沒有看到任何理由,爲什麼不應該工作。出於興趣,如果將'window.location'調用包裝在'setTimeout'中,例如10ms? –

回答

0

嘗試刪除withCredentials:真

Ext.Ajax.request({ 
    url: '/accounts/logout/', 
    method: 'POST', 
    success: function() { 
     console.log('successfully logged out'); 
     window.location.href='/' 
    } 
});