13

We have a single page application which we ship changes to on a regular basis. On rare occasion, a version of the client has a bug and submits a bad request to the server. Even after you ship out an update, there's a possibility old versions of the client can linger.

In these circumstances, it would be useful for the client to send a version identifier along with our requests so that we know whether which version of the code base initiated it.

Are there any existing best practices for this scenario? Attaching an extra header seems like a simple solution, but I don't want to tread new ground if this problem has already been addressed.

Brad Koch
  • 19,267
  • 19
  • 110
  • 137

1 Answers1

16

We're simply using custom HTTP X- headers. Something like X-Client-Version and X-Client-Name.

Brad Koch
  • 19,267
  • 19
  • 110
  • 137
  • I recently read the `X-` prefix is recommended against. See [StackOverflow answer](https://stackoverflow.com/a/3561399/68037) and specifically [RFC 6648](https://www.rfc-editor.org/rfc/rfc6648) – Core Jul 19 '22 at 22:18
  • @core You may follow that recommendation if you like - it is a good idea for general purposes where the header may someday become a standard. You do have discretion in niche or personal contexts; note the use of the weak language [SHOULD NOT](https://datatracker.ietf.org/doc/html/rfc2119#section-4) and Appendix B's analysis of justified rationales and processes for namespace segregation. – Brad Koch Jul 20 '22 at 02:29
  • 2
    In our case, we have preferred the organization name prefix methodology to the meaningless `X` prefix - our parameter naming decisions will never become the standard, and we can avoid unexpected conflicts with future parameter names. – Brad Koch Jul 20 '22 at 02:34