Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Response Header - Application Version

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?

like image 714
James Avatar asked Mar 20 '13 13:03

James


1 Answers

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.

like image 159
Deepak Bala Avatar answered Sep 30 '22 05:09

Deepak Bala