Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MattB's avatar
Level 2

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

I have the below axios request which is going out over https but I get the error:

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 request

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. How would I fix this please?

0 likes
1 reply
MattB's avatar
MattB
OP
Best Answer
Level 2

Adding <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> to the main app file solved it

Please or to participate in this conversation.