angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.54k stars 3k forks source link

HTTP issue in $http request https and http #3527

Closed timyounes closed 4 years ago

timyounes commented 7 years ago

Hello,

I have a problem in my angularjs $http request. When I send request to the API it was blocked by the browser like: ERROR IN FIREFOX : Blocked loading mixed active content “http://www.example.com/rest/default/V1/integration/admin/token/

ERROR IN CHROME: Mixed Content: The page at 'https://www.example.com/load.shtml#/register/pos/docs/2323232221555/new' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.example.com/rest/default/V1/integration/admin/token/'. This request has been blocked; the content must be served over HTTPS.

How can I fixed this problem? Any idea is accepted.

Thanks, timyounes

i23591326 commented 7 years ago

How does this relate to the ui-router?

timyounes commented 7 years ago

I think it is related to the same origin issue

MahlanguRonny commented 6 years ago

The issue is on the server side, change your api to SSL(the url of the api will change to something like https:......), then also enable CORS on the api while at it, then when you run your angular application just confirm that its url has https(meaning it also using SSL) then that way you'll be sending https requests to a https api, unlike http to https which is where ypur issues lies

FlandersBurger commented 5 years ago

I have the same issue going on but it is only one call to my API that seems to be encountering it, all other $http.post (and there are a lot of them) don't have this issue. CORS is already enabled in web.config

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.