magento2-ordercomments icon indicating copy to clipboard operation
magento2-ordercomments copied to clipboard

Method Not Allowed

Open webdachu opened this issue 6 years ago • 4 comments

Hello I have a problem, when click "Place Order" (checkout) i get error:

Method Not Allowed The requested method PUT is not allowed for the URL /pl/rest/pl/V1/guest-carts/ee9577cbbf710fd909783fdbff2a1f14/set-order-comment.

please help me

Best regards

webdachu avatar May 17 '19 07:05 webdachu

hi @webdachu, this looks like a server configuration issue. If you're using apache, maybe the solution from #16 can help resolve your issue?

boldsidney avatar May 17 '19 08:05 boldsidney

not working

webdachu avatar May 17 '19 09:05 webdachu

I encountered the same problem, you'll probably have to enable PUT method in your Apache. I use Directadmin in production environment, and so nothing else but this worked for me: https://help.directadmin.com/item.php?id=700

Cheers

s60v5 avatar May 31 '19 02:05 s60v5

I just found that this same issue affected two very similar Magento modules I tried (by Ulmod and by Magecomp): All three modules rely on the HTTP PUT method, and the fact that I had been blocking it for security reasons is why they didn't work.

In case anyone added a <Limit PUT DELETE> block to a root-level .htaccess file as a method of cargo-cult security (by copying and pasting from one of the many tutorials and examples on the Web), here's a better way to go about it (assuming no Magento module relies on any HTTP method except for HEAD, GET, POST, and PUT:

  • Replace any <Limit> blocks in the .htaccess file in your Magento root with this, outside of any other blocks:
# PUT is required by a module
<Limit GET POST PUT>
    order allow,deny
    allow from all
</Limit>
<LimitExcept GET POST PUT>
    order deny,allow
    deny from all
</LimitExcept>
  • Include the following block in the .htaccess file in your media directory, and in any other subdirectory that exists on the filesystem and doesn't deal with any checkout code:
<Limit PUT>
    order deny,allow
    deny from all
</Limit>

(Actually, that very first <Limit> block, which just allows everything, might not be strictly necessary.) Anyway, I checked the Apache docs, and this syntax works from the current version of Apache (2.4) all the way back to 1.3; if you use some other Web server, the syntax is different but the idea is the same: Make sure that PUT is allowed in the Magento root and not allowed in certain subdirectories, like media.

lewisje avatar Mar 05 '20 07:03 lewisje