What is the X-REQUEST-ID http header?

前端 未结 4 1477
孤独总比滥情好
孤独总比滥情好 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:54

    Explanation using a story/analogy

    Your internet is playing up (as usual), so you call up Tellstra and you're waiting on the phone forever......finally you give up and slam the phone down in frustration. (This is a failed call. And there is a record of it in Tellstra's call logs.)

    "That's it, I'm calling the Ombudsman!"

    But the Obmudsman has thousands of call records to go through (all the failed queries of Tellstra). If you tell them that you called Telstra, and that your call was unsuccessful, that won't be enough: how will the Ombudsman know, from all the call records of Tellstra, which one was yours - so that it can be further investigated??

    That's where the X-Request-ID comes in - when ever you call Tellstra, you'd pass on a random number (the X-Request-ID) and this is logged in the Tellstra records. That way, the ombudsman (having access to all records) will be able to find your incoming call to find out what went wrong.

    Application of story to HTTP

    The same applies to http requests - it's an id used to help you (as the back end dev) find out what went wrong when a client issues you with an error or big report.

    That's the basic summary of it. Any questions etc. just post a comment and I hope to clear it up.

提交回复
热议问题