The parser is most definitely case-insensitive, as indicated by the spec.
Have you disabled parsing modeled headers maybe?
The .header[Type] lookup is optimized and looks up by class instance, which assumes that the header was properly parsed into the expected Type.
# If set to `off`, only essential headers will be parsed into their model classes. All other ones will be provided
# as instances of `RawHeader`. Currently, `Connection`, `Host`, and `Expect` headers will still be provided in their
# typed model. The full list of headers still provided as modeled instances can be found in the source code of
# `akka.http.impl.engine.parsing.HttpHeaderParser.alwaysParsedHeaders`. Note that (regardless of this setting)
# some headers like `Content-Type` are treated specially and will never be provided in the list of headers.
modeled-header-parsing = on
Ugh. akka was doing the right thing. It was just that the location value was malformed (containing whitespace) and someone (me) ignored the warnings. akka actually does one better and still provides the malformed header as the raw value.
Glad you found the issue – yeah our parsing logic tries to be as close to the spec as possible, with loosening up where we know that “real world” actually is not as the spec dictates.
Yes in those cases you can always get the header by name (since it should be still around as Raw one).