A DESCRIPTION OF THE PROBLEM :
Apparenty, those headers are forbidden in HTTP client because XMLHttpRequest API forbids those. (https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name). XMLHttpRequest API forbids those, as allowing them would make Cross-origin resource sharing API insecure. This isn't an issue for Java HTTP client, as it doesn't implement CORS, and due to not being a web browser likely never will. This is useful, as some websites require those headers to work.