docker / docs

Source repo for Docker's Documentation
https://docs.docker.com
Apache License 2.0
4.08k stars 6.99k forks source link

Configured "HttpHeaders" are not sent by Docker daemon #11456

Open KfirCohen opened 3 years ago

KfirCohen commented 3 years ago

Issue:

Configured "HttpHeaders" are not sent to the repository.

Documentation:

engine/reference/commandline/cli.md

Docker version

Docker version 19.03.13, build 4484c46d9d

Platform:

Ubuntu 18 & MacOS

Reproducing:

I am running an HTTPS proxy, which performs the SSL termination. It receives the requests from the daemon and forwards an HTTPS request to the GCR project. The proxy logs all HTTP headers it receives.

  1. Added "HttpHeaders": { "MyHeader": "MyValue" } to ~/.docker/config.json, as documented

  2. Execute docker --config ~/.docker pull https://my_proxy/my_image:tag

  3. Proxy logs all received log HTTP Headers. "MyHeader" is not found

    
    INFO[8654] Client header "Connection": "close"
    INFO[8654] Client header "User-Agent": "docker/19.03.12 go/go1.13.10 git-commit/48a66213fe kernel/4.19.76-linuxkit os/linux arch/amd64 UpstreamClient(Docker-Client/19.03.12 \\(darwin\\))"
    INFO[8654] Client header "Accept-Encoding": "gzip"```
KromDaniel commented 3 years ago

It seems that X-Meta prefix must be added to the headers, wish it was documented somehow :(

KfirCohen commented 3 years ago

Indeed. Doc must be updated.

vsoch commented 2 years ago

Thank you this just helped me too! Yes please update the documentation: https://docs.docker.com/engine/reference/commandline/cli/#custom-http-headers - it is very sparse!

vsoch commented 2 years ago

Is the markdown somewhere in the repository? If it's something I can contribute a PR to, I'd be happy to!

docker-robott commented 1 year ago

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

vsoch commented 1 year ago

I still think this might be useful to have (if it's not been added elsewhere). Thank you!

vsoch commented 1 year ago

/remove-lifecycle stale

Stanislasss commented 9 months ago

Please add this to the documentation, even more that the example doesn't show the prefix in the sample configuration, which is not only scarce but wrong. It would be appreciated by the next one looking for this.

And for the next lost soul: { "HttpHeaders": { "X-Meta-MyHeader": "MyValue" } }

codejanovic commented 2 months ago

@Stanislasss Adding this to the documentation will not help, as the current behaviour of docker is to send the Headers with the X-Meta- prefix instead of omitting it.

Did I miss something or is this feature completley broken anyway?