Http3 not working on non-curl clients

1. The problem I’m having:

I am trying to do a performance comparison on the frontend for http1.1 vs http2 vs http3 server. I was able to get http1.1 and http2 server working locally using docker fairly easily, however getting http3 to work has been a tedious task. The ymuski/curl-http docker image has shown the response to be http3, but I want to test this on any browser only (Tested on chrome/edge - latest versions) - https://protocol.rahulmakhija.in

I have even taken the trouble of setting this up on a remote linode server, but getting the same results.

2. Error messages and/or full log output:

My Caddyfile

{
  debug
  servers {
    protocols h1 h2 h2c h3
  }
}


protocol.rahulmakhija.in {
  tls rahul@example.com
  
  root * /usr/share/caddy/html
  file_server browse
  header Custom-Header "My value"
  log {
    output file /var/log/caddy/access.log
  }
}

My docker-compose.yaml

 http-caddy3:
    image: caddy:2.8.4
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - ./caddy/http3/Caddyfile:/etc/caddy/Caddyfile
      - ./src:/usr/share/caddy/html

Dockerfile

# Use the official Caddy image from Docker Hub
FROM caddy:2.8.4

# Copy static assets to Nginx
COPY src/img /usr/share/caddy/html/img
COPY src/index.html /usr/share/caddy/html/

# Copy your Caddyfile to the container
COPY Caddyfile /etc/caddy/Caddyfile

# Expose the port Caddy will run on
EXPOSE 80
EXPOSE 443

# Start Caddy
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]

3. Caddy version:

2.8.4

4. How I installed and ran Caddy:

docker

docker compose up --force-rebuild

Tried referring to other threads here, but nothing helped. Starting a thread as I want this working on browser only for performance benchmarking reasons.

Nevermind. This was a browser caching issue (Worked on Edge 129 version)
Hard reload was required. (I had tried on a new incognito browser but it still took it from cache?)

How can I get this working locally using http3 & browser ? (while using Dockerfile)

I have copied my root.crt from dockerfile and applied it successfully to get https on localhost but its only working on http2 (tested on chrome & edge)

localhost {
  root * /usr/share/caddy/html
  file_server browse
  header Custom-Header "My value"
  log {
    output file /var/log/caddy/access.log
  }
}

That’s not really a problem with Caddy. Browsers will do what they want. They typically only try HTTP/3 after seeing the Alt-Svc header from the server, but usually if the response is so fast with HTTP/2 it doesn’t have a reason to try it.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.