HTTP request to an API has been blocked from an HTTPS website
.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, https, http, web-services, .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :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:BASEindex.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 endpointhttp://<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.
As a work around, I am proxying the web service:
My SSL Hosting (Angular Project + Newly created proxy web service)
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.
Comments
Post a Comment