S
S
Sergey Malinin2019-12-27 14:59:36
PHP
Sergey Malinin, 2019-12-27 14:59:36

How to set up support for PUT and DELETE requests on a local Xampp server?

I am making a small API in php, I use XAMPP for the local server.
There are no problems with the POST and GET methods, but PUT and DELETE do not work - the request stops at OPTIONS.
5e05ee018bfed623861418.png
Request headers contain
header("Access-Control-Allow-Orgin: *");
header("Access-Control-Allow-Methods: *");
I made a separate OPTIONS request to check which methods are allowed:
5e05ee531ea3f383260705.png
The result is the following:
5e05ee62e3524392541482.png
It turns out that only POST, OPTIONS, HEAD, GET, TRACE are allowed on the server.
Added the following settings to httpd.conf on the server:
5e05eead24ebe153599879.png
No result, only POST, OPTIONS, HEAD, GET, TRACE methods remain available.
I've been trying to figure this out for a few days now, I'm asking for help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lev Zabudkin, 2019-12-28
@zabudkin

And actually what is the problem?
Apache config has a list of allowed trees.
Add it there and that's it.

N
Ninazu, 2019-12-28
@Ninazu

REST - bottom) Don't listen to the hipsters. And forget about it.
Well, in general, it is very similar to the fact that the legs with CORS go.

The Cross-Origin Resource Sharing standard works by adding new HTTP headers that allow servers to describe the set of origins that are allowed to read the information requested by a web browser. In particular, for HTTP request methods that can cause side effects on server data (in particular, for HTTP methods other than GET or for POST requests using certain MIME types), the specification requires browsers to "prevalidate" the request , requesting the supporting methods from the server using the OPTIONS HTTP request method and then, on top of the "confirmation" from the server, sending the actual request with the actual HTTP request method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question