1

I am working on a private server application for a web based mobile game that uses php to generate responses. In order to do this I am trying to replicate the behavior of the main server as closely as possible.

The main server includes the standard Apache response headers Date and Server, however these headers are always preceded by the headers authorize, Content-Encoding, and Content-Type.

I am running apache 2.4.12 on Centos 6 and no matter what I try, the server always sends the Date and Server headers first.

So for example, the current header order:

HTTP/1.1 200 OK
Date: Mon, 18 May 2015 15:48:33 GMT
Server: Apache
authorize: <authToken>
Content-Encoding: gzip

Needs to be sent as:

HTTP/1.1 200 OK
authorize: <authToken>
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Sat, 16 May 2015 02:59:12 GMT
Server: Apache 

I realize that the order of server fields shouldn't matter, however for the sake of not presenting anything that could be used to identify the server as being different than the original, I would like to preserve the original server's behavior.

My first impression was that this might be something changeable by modsecurity, however I've run into a dead end on that approach as the response headers don't appear to be changeable (like the response body is) beyond rewriting the server tag (which is fine as generated).

Mod_headers doesn't appear to be capable of touching the Server header either. It also doesn't seem to offer anything that could potentially change the order of the headers that are set.

Does anyone know of any way that would allow headers to be added above these two headers in an http response? I suspect some third party tool will be required.

Bryan
  • 11
  • 1
  • 1
    The order really does not matter. Everyone just puts these in a hash, dict, or whatever structure before doing anything with them anyway, and never even see what order they came in on the wire. – Michael Hampton May 18 '15 at 17:06
  • Realistically, I realize that this is the case, however when replicating something I always try to match the original as closely as possible. Especially if this is just a matter of apache configuration it could give me some insight into the configuration on the original server. – Bryan May 18 '15 at 17:39
  • You could patch Apache :-) – Alex Jun 03 '16 at 17:26

0 Answers0