Hi, I'm currently trying to send an uppercase header in my proxy's response, I've tried to use this approach without success
I'm executing this policy in the proxy endpoint response postflow
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-UpperCaseHeaders">
<DisplayName>AM-UpperCaseHeaders</DisplayName>
<Set>
<Headers>
<Header name="THISISMAYUS">Hi</Header>
</Headers>
</Set>
<Add>
<Headers>
<Header name="ANOTHERMAYUS">hi_again</Header>
</Headers>
</Add>
</AssignMessage>
I can see the headers in uppercase in the debug session, however I'm receiving lowercase names in the response
I have the feeling that Apigee is converting the headers to lowercase before sending the response to the client, there is a way to avoid this behavior?
Thanks in advance
Solved! Go to Solution.
Header NAMES are case insensitive. Content-Type
is the same as content-type
is the same as CONTENT-TYPE
is the same as cOnTeNt-TyPe
. See IETF RFC 2616.
Header VALUES are case sensitive.
So, ... it's quite possible that Apigee is normalizing the header names to lowercase, but that should not affect behavior of any compliant system. And if Apigee is doing that, then... there is no good way to turn that off or disable that behavior. If your client app insists on a specific casing for header names, your client application is not compliant with the HTTP specification, and should be fixed!
Header NAMES are case insensitive. Content-Type
is the same as content-type
is the same as CONTENT-TYPE
is the same as cOnTeNt-TyPe
. See IETF RFC 2616.
Header VALUES are case sensitive.
So, ... it's quite possible that Apigee is normalizing the header names to lowercase, but that should not affect behavior of any compliant system. And if Apigee is doing that, then... there is no good way to turn that off or disable that behavior. If your client app insists on a specific casing for header names, your client application is not compliant with the HTTP specification, and should be fixed!
Thanks for the answer! we will talk with our client
As per the documentation below, the header should be proper-cased when the client uses HTTP/1.1. But this is not working as expected. We tried HTTP/1.1 in curl but it still returns the lower case content-type. Is the documentation below not accurate?
https://cloud.google.com/load-balancing/docs/https
The documentation you cited is accurate as far as it goes. But when you have Apigee, the ALB is not the only network participant involved. There are other proxies and handlers of traffic.
The main point is that casing of headers is something that http applications - senders and receivers - should not depend on. The case of header names is not semantically relevant. An app that depends on Content-Type ("proper cased") and cannot tolerate content-type (lowercase), is fragile and broken and needs to be fixed.