docs icon indicating copy to clipboard operation
docs copied to clipboard

Configured "HttpHeaders" are not sent by Docker daemon

Open KfirCohen opened this issue 5 years ago • 9 comments

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"```

KfirCohen avatar Oct 01 '20 09:10 KfirCohen

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

KromDaniel avatar Oct 01 '20 12:10 KromDaniel

Indeed. Doc must be updated.

KfirCohen avatar Oct 01 '20 12:10 KfirCohen

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 avatar Apr 12 '22 04:04 vsoch

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

vsoch avatar Apr 12 '22 04:04 vsoch

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

docker-robott avatar Nov 29 '22 01:11 docker-robott

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

vsoch avatar Nov 29 '22 01:11 vsoch

/remove-lifecycle stale

vsoch avatar Nov 29 '22 01:11 vsoch

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" } }

Stanislasss avatar Sep 25 '23 12:09 Stanislasss

@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?

codejanovic avatar May 10 '24 22:05 codejanovic

same here if you use the X-Meta- prefix it works spent 2 week trying to figure this out till I found this issue.

by it works I mean the Docker daemon sends the the headers that are prefixed by X-Meta

fuad-daoud avatar Nov 14 '24 22:11 fuad-daoud

I've just spent some time figuring this limitation out, at least where it's restricted (I didn't understand why it's needed, though).

https://github.com/moby/moby/blob/2937ee5eb15b436b03a5edcafe1854d8ba4da76a/daemon/server/router/image/image_routes.go#L67

https://github.com/moby/moby/blob/2937ee5eb15b436b03a5edcafe1854d8ba4da76a/daemon/server/router/plugin/plugin_routes.go#L24

This is the PR where it was introduced for the first time, so I just asked a question there:

https://github.com/moby/moby/pull/1627

iamolegga avatar Aug 29 '25 20:08 iamolegga