Read the docs
Reserved HTTP Headers The URL Loading System handles various aspects
of the HTTP protocol for you (HTTP 1.1 persistent connections,
proxies, authentication, and so on). As part of this support, the URL
Loading System takes responsibility for certain HTTP headers:
Content-Length
Authorization
Connection
Host
Proxy-Authenticate
Proxy-Authorization
WWW-Authenticate
If you set a value for one of these reserved headers, the system may
ignore the value you set, or overwrite it with its own value, or
simply not send it. Moreover, the exact behavior may change over time.
To avoid confusing problems like this, do not set these headers
directly.
This means you shouldn't manually set these headers. If you REALLY have to then that means there is something wrong with YOUR API.
https://developer.apple.com/documentation/foundation/nsurlrequest#1776617