I am using magento rest api to manage cart. My frontend runs on reactjs. Here is my apache virtual host looks like :

<VirtualHost *:80>
        DocumentRoot /var/www/html/magento/pub

        <Directory /var/www/html/magento/pub>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted

.htaccess in pub folder is same as - https://raw.githubusercontent.com/magento/magento2/2.2-develop/pub/.htaccess

When I am adding anything to cart using : POST - http://localhost/magento/rest/V1/carts/mine I am getting the error 404 in response. I checked the apache log and found this

Client denied by server configuration: /var/www/html/magento/pub/rest

All other api's are working. Please help.

2 Answers 2


You permissions might not be correct. Try to set the permissions as described in the Magento 2 DevDocs


To avoid the 404 response from POSTing or PUTing to an API endpoint, in our case "Require all granted" was needed in the .htaccess file too

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.