Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We have an application that cares about the order of cookie headers. It shouldn't, since this isn't mandated by the standards and indeed we're getting the headers in various different orders

So we would like to rewrite the headers in Apache so that the cookie headers always appear in a specific order. Is there any way of doing this?

An ideal solution would be specifically about cookie headers, but something that lets us mess with the header order more generally would do too.

share|improve this question
Not really a server solution, but could you plug a quick python or perl script in between Apache and your app? Seems like breaking a server to fix code is the wrong way to do things, versus writing a tiny bit of code to fix other code. –  Jack M. Nov 9 '10 at 16:43
Offered mod_headers workaround at Pro Webmasters - would help if you linked between StackExchange sites when cross-posting :) –  danlefree Nov 9 '10 at 17:35
OK - how do I link? I wasn't aware it was possible! –  Paul Nov 9 '10 at 18:09
You might include the permalink as a comment or edit your question to include it (i.e. just add webmasters.stackexchange.com/questions/5231/… toward the end of the question) –  danlefree Nov 9 '10 at 19:28

1 Answer 1

HTTP headers aren't guaranteed to arrive in any particular order, and you shouldn't require them to be. If the cookies are order-sensitive, add an incrementing serial number to the beginning of each one, and reassemble them in your application.

share|improve this answer
I know we shouldn't require them, as I say in the question. Unfortunately the client is an embedded system, and the app is weblogic so we don't have that option –  Paul Nov 9 '10 at 18:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.