Home Mixed-Content over https because an insecure XMLHttpRequest request
Reply: 1

Mixed-Content over https because an insecure XMLHttpRequest request

Babi Published in 2017-12-07 20:31:19Z

I know that something is calling over http instead of https, but actually I don't know how to fix this issue!

    type: "GET",
    url: window.location.href.substring(0, location.href.lastIndexOf("/") + 1) + '/MyService.asmx/MyMethod';,
    data: 'param=' + JSON.stringify({ "myParam": value.trim() });,
    dataType: "text",
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        alert("Request: " + XMLHttpRequest.toString() + "\n\nStatus: " + textStatus + "\n\nError: " + errorThrown);
    }, ...

I even tried this way but no success:

Url: '//MyService.asmx/MyMethod';

Given error is: Mixed Content: The page at 'https://www.example.com/MyPage.aspx' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.example.com/MyService.asmx?param=paramValue'. This request has been blocked; the content must be served over HTTPS.

Any suggestion?

mike_t Reply to 2017-12-08 09:26:43Z

There are several things that might trigger this error.

First of all, change the javascript that construts your url to

window.location.href.substring(0, location.href.lastIndexOf("/") + 1) + 'MyService.asmx/MyMethod'

(remove slash before MyService.asmx and the semicolon at the end)

Try to console.log() the url this code produce and try if it's accessible via HTTPS in your browser. What might be happening is that if the url is unreachable there might be a redirect to non-https url. Also you can use browser debug tools (like chrome inspect Network tab) to see what's happening with your request (look for status code, check the response headers etc.).

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310466 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO