Error with SOAP API when using a different domain for admin access
-
13-12-2019 - |
Question
We have configured our Magento installation so that the admin panel is accessible using a different domain from the main website i.e.
admin.thewebsite.com
Accessing the the SOAP API using
www.thewebsite.com/api/v2_soap?wsdl=1
Results in the WSDL being displayed, however the the soap:address location value in here references the admin.thewebsite.com domain
Which is where the problem lies, as this URL can not be accessed, and simply redirects to the admin panel.
I have switched off the 'Redirect to Base URL' setting in Magento, as suggested in another stack overflow post.
Is there a way to resolve this so Magento does not need to access the admin.thewebsite.com domain for the SOAP API to work?
Solution
The problem in the end was how we had setup the admin domain. We had configured it through ngnix to use the 'admin' store code. Fix was to change the ngnix configuration so if a request to the api route was made, it would not set the store code to admin