What is the X-REQUEST-ID http header?

前端 未结 4 1491
孤独总比滥情好
孤独总比滥情好 2020-12-12 11:17

I have already googled a lot this subject, read various articles about this header, its use in Heroku, and projects based on Django.

However, it\'s still all confuse

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 11:46

    Purpose: Idempotency

    With an ID that changes for every request, but stays the same in case of a retry of a request, the receiver can ensure the request won't get processed more than once.

    This is a quote from some API provider:

    All POST, PUT, and PATCH HTTP requests should contain a unique X-Request-Id header which is used to ensure idempotent message processing in case of a retry

    If you make it a random string, unique per request, it won't infringe on your privacy, nor enable tracking.

    If you want to know more of what idempotency has to offer, read this insightful article.

    N.B. As Stefan Kögl comments, this header is not standardized - hence the (deprecated) "X-" prefix.

提交回复
热议问题