What is the difference between a HTTP-Get and HTTP-POST and why is HTTP-POST weaker in terms of security

后端 未结 5 1290
生来不讨喜
生来不讨喜 2020-11-30 19:59

Can anyone explain the difference between a HTTP-GET and HTTP-POST? And why do people say that a HTTP-POST is weaker in terms of security?

5条回答
  •  误落风尘
    2020-11-30 20:12

    The HTTP specification differentiates POST and GET in terms of their intent:

    GET is idempotent: it is for obtaining a resource, without changing anything on the server. As a consequence it should be perfectly safe to resubmit a GET request.

    POST is not: it is for updating information on the server. It can therefore not be assumed that it is safe to re-submit the request which is why most browsers ask for confirmation when you hit refresh on a POST request.

    In terms of security, no difference. POST is more obscure, perhaps, but that's a very different thing. Security needs to be added at another layer, for example SSL.

提交回复
热议问题