保存产品时出现 Shopware 6 错误(Method Not Allowed The requested method PATCH is not allowed for this URL)

Shopware 6 error when saving product (Method Not Allowed The requested method PATCH is not allowed for this URL)

我刚刚安装了 Shopware 6。当我尝试保存新产品时,它抛出了 url 的控制台错误 https://myshop.com/api/v3/product/b152cac84ddc4aadbecac8e3ba5f65af

Method Not Allowed
The requested method PATCH is not allowed for this URL.

当我填写最少的必填字段时,它确实保存了。但是当我填写更多字段时,它会抛出此错误。我没有很彻底地测试它,所以我不确定是哪个字段导致的。

这是库存的 Shopware 6,我还没有做任何自定义的东西。

似乎是 Direct Admin 的服务器配置问题,默认情况下会阻止非标准 HTTP 方法。

修复了它
cd /usr/local/directadmin/custombuild
./build set http_methods GET:HEAD:POST:PUT:DELETE:PATCH
./build rewrite_confs 

来源:https://help.directadmin.com/item.php?id=700

如果它对您不起作用(因为它对我不起作用),请尝试:

cd /usr/local/directadmin/custombuild
./build set http_methods ALL
./build rewrite_confs

来源:https://docs.directadmin.com/webservices/apache/customizing.html#enabling-put-and-delete-methods-in-apache-nginx