I have been trying to redirect requests from one traefik to another traefik and finally to access a docker registry.
It works but if I try to pull a bigger image, it fails.
First traefik:
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.http]
[entryPoints.http.http.redirections]
[entryPoints.http.http.redirections.entryPoint]
to = "https"
scheme = "https"
[entryPoints.https]
address = ":443"
Second traefik:
job "traefik-docker-test" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "traefik-docker-test" {
count = 1
network {
port "http" {
to = 5000
}
port "external" {
to = 80
}
}
task "traefik-test" {
driver = "docker"
config {
image = "traefik:2.11"
force_pull = true
ports = ["external"]
volumes = [
"local/traefik.yml:/etc/traefik/traefik.yml",
"local/traefik-test.yml:/etc/traefik/traefik-test.yml",
]
logging {
type = "journald"
config {
tag = "TEST-TRAEFIK"
}
}
}
template {
destination = "local/traefik.yml"
left_delimiter = "{{{"
right_delimiter = "}}}"
data = <<EOF
---
log:
level: INFO
providers:
file:
filename: "/etc/traefik/traefik-test.yml"
entryPoints:
web:
address: ":80"
EOF
}
template {
destination = "local/traefik-test.yml"
left_delimiter = "{{{"
right_delimiter = "}}}"
data = <<EOF
---
http:
routers:
registry-test:
rule: "Host(`registry-test.mydomain.ai`)"
service: "registry-test"
middlewares:
- "auth-forward"
entryPoints:
- "web"
{{{ with service "docker-test" }}}
services:
registry-test:
loadBalancer:
servers:
- url: "http://{{{ (index . 0).Address }}}:{{{ (index . 0).Port }}}"
{{{ end }}}
{{{ with service "auth-service" }}}
middlewares:
auth-forward:
forwardAuth:
address: "http://{{{ (index . 0).Address }}}:{{{ (index . 0).Port }}}"
trustForwardHeader: true
authResponseHeaders:
- "X-Forwarded-Method"
{{{ end }}}
EOF
}
resources {
cpu = 100
memory = 128
}
service {
name = "test-traefik"
port = "external"
tags = [
"traefik.enable=true",
"traefik.http.routers.test-traefik.rule=Host(`registry-test.mydomain.ai`)",
"traefik.http.routers.test-traefik.tls.certResolver=mydomain-le",
"traefik.http.routers.test-traefik.tls=true",
]
check {
name = "alive"
type = "tcp"
port = "external"
interval = "10s"
timeout = "2s"
}
}
}
}
}
As you can see I'm also using consul to resolve between services.
The login to the middlewares:- "auth-forward" goes well, I can even pull and push hello world, but nothing bigger.
I was expecting to be able to pull and push bigger images, I imagine it has something to do with https but is not clear to me.