With default haproxy router, if I expose registry on port 5000, the router strips the port on each request from Host header.
When registry redirects the client as a response to POST request initiating blob upload, it will use just the url in Host header as a base for the value in Location header.
During the next client request, the Location will be used resulting in failure because port 80 is not exposed.
Version
master
Steps To Reproduce
- deploy registry
- deploy router like this:
oadm router router --ports 5000:5000 -o json | oc env -f - --output=json ROUTER_SERVICE_HTTP_PORT=5000 | oc create -n default -f -
- expose the registry using route:
oc expose service docker-registry --hostname=registry.f24-ose.vm -n default
- Add
--insecure-registry=registry.f24-ose.vm:5000 to docker daemon's flags.
docker login -u unused -p $(oc whoami -t) -e unused registry.f24-ose.vm:5000
docker tag busybox registry.f24-ose.vm:5000/$proj/buxybox
docker push registry.f24-ose.vm:5000/$proj/buxybox
Current Result
The push fails on PATCH request: Upload failed: dial tcp 192.168.100.80:80: getsockopt: connection refused (extracted from docker daemon log).
Note the port 80 as a result of Location header in registry's response to POST: http://registry.f24-ose.vm/v2/pjoe/hello-world/blobs/uploads/3d70392c-0751-4190-9508-ab9efb450d99?_state=6VTnYEsxOJZCFVr8zthbXcPCV4t4S__QMsNL1OCLHaN7Ik5hbWUiOiJwam9lL2hlbGxvLXdvcmxkIiwiVVVJRCI6IjNkNzAzOTJjLTA3NTEtNDE5MC05NTA4LWFiOWVmYjQ1MGQ5OSIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAxNi0xMC0xMlQxMzo1MDozNS4xNjI4MDQ4MzlaIn0%3D
(Note the missing :5000).
Expected Result
I'd expect the proxy to either pass the Host header unmodified to the exposed service or to modify Location header of service's responses to contain ports.
With default haproxy router, if I expose registry on port
5000, the router strips the port on each request fromHostheader.When registry redirects the client as a response to POST request initiating blob upload, it will use just the url in
Hostheader as a base for the value inLocationheader.During the next client request, the
Locationwill be used resulting in failure because port80is not exposed.Version
master
Steps To Reproduce
oadm router router --ports 5000:5000 -o json | oc env -f - --output=json ROUTER_SERVICE_HTTP_PORT=5000 | oc create -n default -f -oc expose service docker-registry --hostname=registry.f24-ose.vm -n default--insecure-registry=registry.f24-ose.vm:5000to docker daemon's flags.docker login -u unused -p $(oc whoami -t) -e unused registry.f24-ose.vm:5000docker tag busybox registry.f24-ose.vm:5000/$proj/buxyboxdocker push registry.f24-ose.vm:5000/$proj/buxyboxCurrent Result
The push fails on
PATCHrequest:Upload failed: dial tcp 192.168.100.80:80: getsockopt: connection refused(extracted from docker daemon log).Note the port 80 as a result of
Locationheader in registry's response toPOST:http://registry.f24-ose.vm/v2/pjoe/hello-world/blobs/uploads/3d70392c-0751-4190-9508-ab9efb450d99?_state=6VTnYEsxOJZCFVr8zthbXcPCV4t4S__QMsNL1OCLHaN7Ik5hbWUiOiJwam9lL2hlbGxvLXdvcmxkIiwiVVVJRCI6IjNkNzAzOTJjLTA3NTEtNDE5MC05NTA4LWFiOWVmYjQ1MGQ5OSIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAxNi0xMC0xMlQxMzo1MDozNS4xNjI4MDQ4MzlaIn0%3D(Note the missing
:5000).Expected Result
I'd expect the proxy to either pass the
Hostheader unmodified to the exposed service or to modifyLocationheader of service's responses to contain ports.