0
votes

Angular HTTP request is blocked - Showing mixed content.

But when i'm accessing through browser URL, the content is showing.

The angular code is:

            $http.post('http://crms.ttteamthoi.in/get_timespent_br', {
                'from': '01/11/2015',
                'to': '25/11/2015'
            }, {
                "headers": {
                    "Content-Type": "application/json; charset=UTF-8"
                }
            })
            .then(function(response) {
              //code here
            }

The console error showing is:

Mixed Content: The page at 'https://dash-thaidash.c9users.io/#/app/tonnage' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://crms.ttteamthoi.in/get_timespent_br'. This request has been blocked; the content must be served over HTTPS.

Is this angular specific?

2
Do you have access to the controller code or is this a third party? It seems also that it has detected you are making and ajax request and does not accept it as secure...alexandra
I'm using this code in my controller. Does this ajax request only accepts secure ones?Husni Abdul Nazer
I meant to ask if you have access to the code executed at 'crms.ttteamthoi.in/get_timespent_br' this route. It can check how the request is made and weather it is ajax or not and interpret this.alexandra
The server is written in asp.net. Unfortunately i dont have access to it. Its a third party application. But the link is working fine when accessing through browser and even in hurl.itHusni Abdul Nazer
So it seems from the request and the answers that the thirs party does not accept the ajax request. This is sometimes implemented in sonata.alexandra

2 Answers

1
votes

It does not seem to be Angular specific. crms.ttteamthoi.in host is telling you that accepts only https requests, but you POST some data using http protocol. Try using https.

You can simulate http requests here.

1
votes

Problem Solved.

Server is asp.net application without SSL. The call was from https://c9.io which is secure. That was the mixed content error.

Changing the server application to SSL & then enabling CORS for content type did the trick.