0

Not quite sure where to start debugging, PUT/POST request occasionally without any errors in Magento logs, status code 400. The exact same request later goes through succesfully.

Example failed request:

400 PUT /rest/V1/products/9793/stockItems/1567?stockItem%5Bqty%5D=466&stockItem%5Bis_in_stock%5D=1 HTTP/2.0 varnish

Example successfull request moments later:

200 PUT /rest/V1/products/9793/stockItems/1567?stockItem%5Bqty%5D=466&stockItem%5Bis_in_stock%5D=1 HTTP/1.1 phpfpm

200 PUT /rest/V1/products/9793/stockItems/1567?stockItem%5Bqty%5D=466&stockItem%5Bis_in_stock%5D=1 HTTP/2.0 varnish

Added a log in Magento\CatalogInventory\ModelStockRegistry updateStockItemBySku function, for the failed requests this function is never reached.

Thought it might have to do with Varnish, so I added a bypass, but this had no effect:

if (req.url ~ "^/rest/") {
 return (pass);
}

Using Magento 2.4.5-p11, Varnish 6.1.1. Only happens on PUT/POST requests.

Any tips on where to start debugging?

asked Mar 7 at 10:05

1 Answer 1

1

Still not entirely sure what caused the issue, after testing different scenarios it turned out Cloudflare was interfering with the requests.

Bypassing the cache and WAF inside Cloudflare had no effect, however lowering the 'security level' did the trick.

There may have been too many requests from one source where Cloudflare flagged and blocked/altered the request, even though the Cloudflare event logs stayed empty.

answered Mar 11 at 11:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.