'How does webserver handle HTTP POST [closed]

This might be a very basic question. But, the question that I am trying to address is that Webserver is there to handle HTTP Requests, So it's fully capable of handling HTTP verbs such as GET, POST etc.

With GET we are returning the request that the user is requesting. So web server can return the resource back to the user. But when it comes to POST, the static results can not be returned. POST is supposed to be dynamic. In this case, without the help of an application server, how does the webserver alone serve post requests. because the result needs to be generated dynamically which the webserver is not capable of. however, the basic purpose of the webserver is to support HTTP protocol. Therefore it should be capable of supporting HTTP POST as well. Could anybody share some light on this to clarify this doubt



Solution 1:[1]

It depends on the HTTP server.

Python's SimpleHTTPServer / http.server are designed to handle static files only. They do not handle anything but GET and HEAD, and will respond with 501 Unsupported method.

If you start nginx, and do not specify a CGI/FastCGI/uWSGI handler, you'll get 405 Not Allowed for most methods other than HEAD/GET, except 403 Forbidden for POST.

Finally, some servers might silently (and incorrectly) respond the same way they'd respond to GET.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 szym