Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lermontex opened this issue Jan 15, 2024 · 2 comments
Assignees

Comments

@lermontex
Copy link

lermontex commented Jan 15, 2024

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?

@francislavoie
Copy link
Member

/cc @dunglas

@mholt
Copy link
Member

mholt commented Apr 17, 2024

I am not actually sure what the expected behavior for 1xx is -- maybe it's hop-by-hop? Seems like it should go through, though. I'll leave it up to @dunglas when he has a chance :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants