I am trying to come up with a way to expose the specific build number of a web service (REST and SOAP interfaces) using HTTP in response to messages.
Just to be clear I am not trying to control which version of an application is being used by a client as this is handled by the traffic manager and service registry (also much discussed already), I only want to be able to debug later what version was used or is being used, e.g., to check the traffic manager is serving up the correct version.
I have spent a long time looking at the HTTP spec and can't decide between using Pragma
Pragma: application-version=1.0.0-SNAPSHOT
using an additional Server
header
Server: Apache-Coyote/1.1
Server: MyService-1.0.0-SNAPSHOT
using a Via
Via: MyService-1.0.0-SNAPSHOT
or a customer header
X-ApplicationVersion: 1.0.0-SNAPSHOT
To my mind using a Via
or a Server
is semantically incorrect but using an X-
header bears the risk of being dropped by proxies but Pragma
is unconstrained and thus more difficult to parse if wanted to use it programmatically.
I also have a feeling that multiple Server
headers won't be respected but there is no way to specify multiple values with the container I'm using (JBoss).
Is there any precedent for this?
Anyone have any tips?
Should I just shut up and use one?
To my mind using a Via or a Server is semantically incorrect but using an X- header bears the risk of being dropped by proxies
I would not worry too much about the X headers being dropped. Take this call to the ebay finding service for example
http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&keywords=harry%20potter
The response includes this header.
X-EBAY-SOA-SERVICE-VERSION: 1.12.0
I've seen the X headers used quite a lot for this purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With