Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCP HTTP(S) Load Balancers will convert HTTP/1.1 header names to lowercase, could my code be affected?

Tags:

Yesterday I received a mail from GCP telling about Load Balancer and upper and lowercases headers. A part of the message is:

After September 30, HTTP(S) Load Balancers will convert HTTP/1.1 header names to lowercase in the request and response directions; header values will not be affected.

As header names are case-insensitive, this change will not affect clients and servers that follow the HTTP/1.1 specification (including all popular web browsers and open source servers). Similarly, as HTTP/2 and QUIC protocols already require lowercase header names, traffic arriving at load balancers over these protocols will not be affected. However, we recommend testing projects that use custom clients or servers prior to the rollout to ensure minimal impact.

Google talk specificly about request and response header names (not values) but, for example, is Google Load Balancer asking to me to replace a classic PHP redirection header "Location" into a lowercase "location"?

header("location: http://www.example.com/error/403");

Of course, the plan is to do what the standars says, but in many cases will be work that cant will be done before GCP deadline (September 30, 2019).

As is a standard, all modern browsers are prepared to use case insentive header names? Should I be worry about files naming? (camelcases) If is the case, there exist some mod in Apache (for example) to use meanwhile I change my code?

https://cloud.google.com/load-balancing/docs/https/

like image 218
Benjamin Avatar asked Jul 02 '19 12:07

Benjamin


1 Answers

HTTP/1.1 specification specifies that HTTP headers are case insensitive. This only applies to the header name ("content-type") and not the value of the header ("application/json").

In the event that this new policy will cause problems for you, you can contact Google Support and opt-out temporarily.

For code that is correctly written and performs case-insensitive comparisons, you will not have problems. In most cases, you can use curl with various HTTP headers to test your backend code. Of course, completing a code walkthru is a good idea.

Example curl command:

curl --http1.1 -H “x-goog-downcase-all-headers: test” http://example.com/

Curl documentation for the --http1.1 command line option: https://curl.haxx.se/docs/manpage.html

As is a standard, all modern browsers are prepared to use case insentive header names?

Yes. This has been the norm for a long time.

Should I be worry about files naming? (camelcases)

No. The new changes do not affect values of HTTP headers, only the header names.

If is the case, there exist some mod in Apache (for example) to use meanwhile I change my code?

No that I am aware of.

like image 121
John Hanley Avatar answered Oct 01 '22 23:10

John Hanley