簡體   English   中英

“網站”頁面已通過 HTTPS 加載,但請求了不安全的 XMLHttpRequest 端點“網站”

[英]The page at 'website' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'website'

我有以下 axios 請求,該請求將通過 https 發出,但出現錯誤

The page at 'http://websitename/folder1/folder2/api/atlas/home/coach' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://websitename/folder1/folder2/api/user?userid=15'. This request has been blocked; the content must be served over HTTPS.

Axios 請求者

loadUser() {    
            this.memberid = this.$route.params.userid;             
            if (axios == null) {
                    return;
                }  
                axios
                .get('https://websitename/folder1/folder2/api/atlas/api/user/', {
                    params: {
                        userid: this.loggedinuser
                        }
                    })
                .then(res => {
                    this.user = res.data.user[0].name;                 
                })
                .catch(err => {
                    console.log(err);
                });
            }

In the network logs, I can see the request URL is going over HTTPS, but the Response header is http in the location field. 請問我該如何解決?

添加<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">解決了這個問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM