3

Is there any accepted naming convention for custom http headers in an in-house web application?

in-house in the strict sense means that requests with this header will never be transmitted over the public internet. in-house in a liberal sense means that while requests may be transferred over the public internet the server endpoint will always be a machine under control of a specific vendor.

i am aware of this SO article and the RFC 6648.

However, the reasoning forwarded in the latter reference does not quite convince me as it says:

2.  SHOULD employ meaningful parameter names that they have reason to
    believe are currently unused.

3.  SHOULD NOT prefix their parameter names with "X-" or similar
    constructs.

Well, X-<meaningful_name> conveys the semantics suggested by <meaningful_name> + the information that this header has neither been assigned by nor registered with an official standard maintaining authority, so the items 2., 3. appear a bit contradictory.

Of course, I could use other monikers like Vnd- or a company/product name prefix or even a customary term like Foo-. the arguments against the X- prefix would still apply, however.

On the other hand, just using a 'meaningful name' invites future collisions with the same term being endorsed by an official standard or some other company whose products will become part of the processing pipeline.

ps: apologies if this question is considered overly unspecific. I'll be happy to move it to some other more suitable venue.

Community
  • 1
  • 1
collapsar
  • 17,010
  • 4
  • 35
  • 61
  • Did you find my answer acceptable? If so, can you accept it as the answer? Thanks. – Aaron Greenlee Sep 17 '14 at 01:19
  • I'm very sorry but I think I don't. The `VND` prefix solution is equivalent to an `X-` prefix which the rfc deprecates. As an aside, you must have name rights to the domain part to be sure not to interfere with someone else (so no non-profit jobs) and the main contractor may opt against your company name in deliverables (granted, the latter concerns do not apply to `VND.example.com.`, which is, however, still a variant of `X-`). Uuids as keys are a nightmare to maintainers and debuggers. Finally, I'm well aware of the rfc you've linked, cf. link and quote above ... – collapsar Sep 17 '14 at 11:13
  • Perhaps you could answer with your solution? No one else in the SO community seems to be on this one. Thanks. – Aaron Greenlee Sep 23 '14 at 16:46

1 Answers1

5

Yes, there is a accepted naming convention.

VND.{domain}.{key}

Example: VND.wreckingballmedia.com.runtime = 102ms

You can read the official recommendation here: https://www.rfc-editor.org/rfc/rfc6648

It basically says that everyone thought "X-MyNonStandardHeader = Value" was a good idea but there are still naming collisions. It says you might get away with UUIDs or something, but, they recomend the VND.domain.key format.

Community
  • 1
  • 1
Aaron Greenlee
  • 4,587
  • 4
  • 26
  • 37