New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] PUT and POST return "501 Method not implemented" on http connection #9838

Closed
robertslagter opened this Issue Dec 12, 2015 · 8 comments

Comments

Projects
None yet
5 participants
@robertslagter

robertslagter commented Dec 12, 2015

When trying to perform any PUT or POST command on the REST API (v3) over a http connection, the user receives a "501 Method Not Implemented" error.
The error occurs for instance on updating products (one product or in bulk) using the Python official library, cURL or the PHP library.
GET commands work as intended. Please note that the issue occurs even though the user credentials refer to an admin account, which has read/write access in the WooCommerce API.

The exact error message is:
PUT to /wc-api/v3/products/156 not supported.
(while 156 refers to a valid product id)

@claudiosanches

This comment has been minimized.

Member

claudiosanches commented Dec 13, 2015

I bet that have something in your server changing it, like something in your .htaccess or nginx config.
Many servers have PUT, POST and DELETE blocked for safety.
Please check it.

@robertslagter

This comment has been minimized.

robertslagter commented Dec 13, 2015

I hope you are right, but it does not seem to be the case.
My .htaccess does not include anything special I think:

RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

I have asked my provider today, and they do not have any other rewrite or blocking rules running.
Thank you so much for helping, as this is driving me crazy ;-)

@claudiosanches

This comment has been minimized.

Member

claudiosanches commented Dec 13, 2015

Still can be have it in your apache config.
Check it too.

@robertslagter

This comment has been minimized.

robertslagter commented Dec 13, 2015

You were right! Thank you so much - my hosting provider had a check in apache that prevented PUT requests. While they were digging into the issue they found out logging was not set up properly, and because of that the error did not show up in my logs.

The PUT request was blocked by:
modsecurity_crs_30_http_policy.conf

@claudiosanches

This comment has been minimized.

Member

claudiosanches commented Dec 13, 2015

Cool, tomorrow I'll add a note about it in our docs. Thanks.

@claudiosanches

This comment has been minimized.

@hram908

This comment has been minimized.

hram908 commented Sep 12, 2017

Note: 404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment