2

I am facing problem to call web service which is hosted over HTTP and I am calling web service from HTTPS domain.

web service's .htaccess

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]

I got following error in console when I am trying to calling web.

angular.min.js:93 Mixed Content: The page at https://www.<my-domain.com>/#/ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint http://<api url goes here>. This request has been blocked; the content must be served over HTTPS.

Note

Web service is hosted in AWS server which is HTTP only and my website is hosted to other hosting provider.

4
  • 4
    Well, it's fairly simple. You aren't allowed to load http in an https website. If that hoster cant go implement SSL, go to another hoster :)
    – Martijn
    May 3, 2016 at 7:01
  • 1
    Because all internal and external resources such as JavaScripts, Images, CSS etc MUST to be loaded over HTTPS... May 3, 2016 at 8:23
  • it is not possible using htaccess or from anything? May 3, 2016 at 8:26
  • 2
    Absolutely not possible... your site is either SSL or its not... everything must be HTTPS in order for SSL to be secure. May 3, 2016 at 8:29

1 Answer 1

1

As a work around, I am proxying the web service:

  1. My SSL Hosting (Angular Project + Newly created proxy web service)

  2. AWS (Old Web service + MySql Database)

From angularJS i call newly created proxy (that just uses cURL). This cURL code passes request to AWS server over HTTP.

1

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.