Skip to content

Caddy does not pass 103 (Early Hints) headers through the reverse proxy chain #6041

@lermontex

Description

@lermontex

I'm using Docker Compose to initialize multiple containers

I have fastify app + @fastify/early-hints - (http://container1.node.local:3000)

app.get("*", async (request, reply) => {

await reply.writeEarlyHintsLinks([
    { href: "/index.js", rel: "preload", as: "script" },
    { href: "/index.css", rel: "preload", as: "style" }
]);

// some work

await reply
        .code(200)
        .type("text/html")
        .header("X-Test", "Test header")
        .send(html);
});

Proxy Server 1 (https://container1.caddy.local):

Caddyfile

#...
reverse_proxy http://container1.node.local:3000

Proxy Server 2 (https://container2.caddy.local):

Caddyfile

#...
reverse_proxy {
    header_up Host container1.caddy.local
    to https://container1.caddy.local
    transport http {
        tls_insecure_skip_verify
        tls_server_name container1.caddy.local
        read_buffer 8192
    }
    header_down -Server
}

I am running requests:

curl -k -v --http2 http://container1.node.local:3000 - OK (X-Test Custom Header present, 103 Early Hints Headers present)
curl -k -v --http2 https://container1.caddy.local - OK (X-Test Custom Header present, 103 Early Hints Headers present)
curl -k -v --http2 https://container2.caddy.local - BAD (X-Test Custom Header present, 103 Early Hints Headers missing)

Is this a bug or is it supposed to be like this? Is it possible to configure Caddy so that headers are passed along the entire chain?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions