I want to try and use Swagger on a local development env running on MAMP, but i'm running into issues with the base url of my dev site. The UI is generated fine when i hit but when i use the "try it out" function, the Request URL that is passed in is:

and not

This is kicking the Response Headers:

"error": "no response from server"

which is to be expected since it's not the correct url.

Is there a way to set the base url for swagger so that it takes in the full url and not the partial that is getting passed in now? When i look at the path for the full config file that is passed in, it's clear where the issue is:

        "title":"Magento Community"

I need to update the host. How is that possible?


1 Answer 1


Figure out a solution. MAMP is able to run any custom url that you pass in, as long as you set up the configuration files correctly.

In the MAMP dir root set up a directory for the magento install:


In your httpd.conf file you need to enable the use of the correct vhost file and make sure that you are listening on port 80:

file: /Applications/MAMP/conf/apache/httpd.conf

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
Listen 80

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

In your vhost file you need to set the configurations for the new url path:

file: /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/Applications/MAMP/htdocs/magento222.local"
    UseCanonicalName Off
    ServerName magento222.local
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common

For me, as I'm on OSX, I have to edit my hosts file on my local machine to set up the correct port forwarding. This is a read only file, so you will need to have sudo rights to edit it.

file: /etc/hosts

# mamp custom urls tester.test magento222.test magento220ee.test

From there you just have to make sure that MAMP is using the default port of 80:

enter image description here

You can use the button Set MAMP ports to default to get these settings reset. Now, if you are using port 80 for something else, this might conflict. In that case there might be some more info to reference there. But you should now be able to hit the url and use it to test your APIs without errors



I was originally using the url http://magento_222.test/ which was causing issues with the cookie domain being set. Not sure why, but the underbar in the name didn't jive well with magento and hitting the admin. So removing it did the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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