Use core API instead of raw header read.

Refer
https://github.com/silverstripe/silverstripe-framework/pull/3152/files