2

I'm running Magento CE 1.8.1 and trying to access my Magento site over the API using the URL http://www.mysite.com/index.php/api/v2_soap?wsdl=1, but I'm getting redirected to https://www.mysite.com/index.php/api/v2_soap?wsdl=1. The site recently went live, and the API worked fine. The development site was not running over https, and was not getting redirected.

Any thoughts on how to avoid the URL getting redirected to https?

Thanks!

4 Answers 4

1

Since your web/secure/base_url on your dev server was set to

www.mysite.com/

Then your api url and other secure url would be www.mysite.com/ but now that your live site is https then you will get redirected.

Also since your api calls contain your api usename and password you should update your url to https. You may also want to considering using self-signed ssl certificates for you dev environment.

1
  • Not a good idea to pass API credentials in the clear as HTTP does, you're just asking for a packet sniff and a hack... So it's highly appropriate as pointed out to have the Magento API only available on HTTPS when secure base URL has been supplied. Aug 25, 2014 at 23:42
1

You need to uncomment a line in the .htaccess file

############################################
## uncomment next line to enable light API calls processing

    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]
0

api should works with both http and https. There are some htacces redirection available ,which prevent the redirection.Contact with hosting provide and i facing same problem in my one project.Hosting provider have solved this.

0

In the Magento configuration, you can find the Auto-redirect to Base URL option.

One solution may be to set it to No instead of the 301/302 redirects.

Configuration is located here : System > Web > Url Options > Auto-redirect to Base URL


Another solution is to set a rewrite rule on the web server config (here Apache vhost) :

RewriteCond %{REQUEST_URI} /api/
RewriteRule ^ http://magento.biz%{REQUEST_URI} [L,R]

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.