0

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?

6
  • 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... Commented Dec 16, 2015 at 7:11
  • I'm using this code in my controller. Does this ajax request only accepts secure ones? Commented Dec 16, 2015 at 7:16
  • 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. Commented Dec 16, 2015 at 23:00
  • 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.it Commented Dec 17, 2015 at 9:36
  • 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. Commented Dec 17, 2015 at 21:13

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

2 Comments

I used https, but its a SSL ERROR. im getting the content while accessing the link through browser.
Hey, i'm getting the response in Hurl.it. Response: Cache-Control: private, max-age=0 Content-Length: 3373 Content-Type: application/json; charset=utf-8 Date: Wed, 16 Dec 2015 07:20:27 GMT Server: Microsoft-IIS/7.5 X-Aspnet-Version: 4.0.30319 X-Powered-By: ASP.NET

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.