0

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.

0

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

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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