500 error Method not allowed. Must be one of: GET, POST

Hi,
i run into this error when using angular HttpClient with some header ( for CORS stuff ) to get or post some data to Slim App

i don’t get this error when i don’t use HttpHeader
i don’t get this error when using Postman and jquery Ajax ( $.get )
i don’t get this error when using any instead of post or get

when using $request->getMethod(), i have GET or POST

Can anyone help ? Please ?

My guess is that you haven’t set up middleware to handle OPTIONS requests.

There are some suggestions here, http://www.slimframework.com/docs/v4/cookbook/enable-cors.html .

i already added this lines, result is the same

Instead of using a catch all route, you could try to define the routes for all OPTION routes explicitly and include a special CORS middleware as described here: