Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Apigee X (actually GCP LBs) convert header names to lowercase

GCP HTTP(S) Load Balancers convert HTTP/1.1 header names to lowercase in the request and response directions. See: https://cloud.google.com/load-balancing/docs/https/#target-proxies and search for "lowercase".

The HTTP/1.1 specification states that header names are case-insensitive, so this behavior should not affect existing backend APIs. However, if your backend API does expect a case-sensitive header name (e.g. Authorization) you can work around this in Apigee by creating a simple Assign Message:

 

 

 

<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-case-sensitive-authorization">
    <DisplayName>AM-case-sensitive-authorization</DisplayName>
    <AssignVariable>
        <Name>save_auth</Name>
        <Ref>request.header.authorization</Ref>
    </AssignVariable>
    <Remove>
        <Headers>
            <Header name="Authorization"/>
        </Headers>
    </Remove>
    <Set>
        <Headers>
            <Header name="Authorization">{save_auth}</Header>
        </Headers>
    </Set>
</AssignMessage>

 

 

 

Note that just using Set Header does not work when the request already has an "authorization" header, as would be the case in a simple pass through proxy.

Hope this helps!

 

1 2 1,127
2 REPLIES 2