I am setting my https in Magento, and I hope every http:// will redirect to https:// automatically. I set the config in apache level
<VirtualHost *:80>
 ServerName local.example.com
 Redirect / https://local.example.com/
</VirtualHost>
It works in frontend and admin.
However, when I try to call the API with POST method http://local.example.com/index.php/rest/V1/integration/customer/token
It returns
{ "message": "Request does not match any route.", "trace": null }
If I call with https://, it returns expected result.
Anyone could help? I would like calling http:// also redirect to https:// and returns correct result.
1 Answer 1
Add this into your .htaccess located on Magento root:
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
Test with Magento EE 2.1.7