Question

Can my store resolves API request using custom admin url? Eg: https://admin.magento.lc/api/v2_soap?wsdl=1? Here problem is if I use api url via custom admin url it redirects to frontend.

Was it helpful?

Solution

After having a look into /app/code/core/Mage/Api/etc/config.xml i saw, that the route is only configured for the frontend, not for admin:

<config>
<modules ...>
<global ...>
<frontend>
        <routers>
            <api>
                <use>standard</use>
                <args>
                    <module>Mage_Api</module>
                    <frontName>api</frontName>
                </args>
            </api>
        </routers>
...
</frontend>

So there is no admin-route for /api which might be the cause why you get redirected. I did not test it though.

OTHER TIPS

First solution is to deactivate the 301 or 302 redirect from System > Web > Url Options > Auto-redirect to Base URL

Then try again without custom admin url : http://magento.dev/api/v2_soap/index/wsdl/1/

This may cause some issues loosing http://example.com/store/ to http://www.example.com/store/ redirections...


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

RewriteCond %{HTTP_HOST} ^admin\.magento\.biz$ [NC]
RewriteCond %{REQUEST_URI} /api/
RewriteRule ^ https://magento.biz%{REQUEST_URI} [L,R]
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top