Apigee X Automatically converting headers to lowercase

Hi,  I'm currently trying to send an uppercase header in my proxy's response, I've tried to use this approach without success 

https://www.googlecloudcommunity.com/gc/Apigee/Apigee-X-actually-GCP-LBs-convert-header-names-to-low...

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

Edsasto_0-1640808978559.png

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 Solved
1 2 1,428
1 ACCEPTED 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.

rfc2616.png

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! 

View solution in original post

2 REPLIES 2

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.

rfc2616.png

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