Http/3 not working in localhost

1. Caddy version (caddy version): 2.4.6

2. How I run Caddy:

running caddy in localhost to serve a html webpage.

a. System environment:

Mac0s BigSur V11.2

b. Command:

caddy start

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

{
        debug
	servers :443 {
		protocol {
			experimental_http3
		}
	}
}


localhost:443 {
  root * /path to static page
  file_server
}

3. The problem I’m having:

With above mentioned caddy file I ran caddy to serve a static html page to see how http/3 works in caddy.
I ran https://localhost:443 but it is still serving it as h2 request.
pls guide me If I am missing something

4. Error messages and/or full log output:

2022/01/02 06:52:46.562 INFO using adjacent Caddyfile

2022/01/02 06:52:46.563 WARN input is not formatted with ‘caddy fmt’ {“adapter”: “caddyfile”, “file”: “Caddyfile”, “line”: 2}

2022/01/02 06:52:46.564 INFO admin admin endpoint started {“address”: “tcp/localhost:2019”, “enforce_origin”: false, “origins”: [“localhost:2019”, “[::1]:2019”, “127.0.0.1:2019”]}

2022/01/02 06:52:46.564 INFO tls.cache.maintenance started background certificate maintenance {“cache”: “0xc0002ca000”}

2022/01/02 06:52:46.564 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {“server_name”: “srv0”, “https_port”: 443}

2022/01/02 06:52:46.564 INFO http enabling automatic HTTP->HTTPS redirect{“server_name”: “srv0”}

2022/01/02 06:52:46.566 INFO tls cleaning storage unit {“description”: “FileStorage:/Users/mathivanan.paulraj/Library/Application Support/Caddy”}

2022/01/02 06:52:46.566 INFO tls finished cleaning storage units

2022/01/02 06:52:46.694 INFO pki.ca.local root certificate is already trusted by system {“path”: “storage:pki/authorities/local/root.crt”}

2022/01/02 06:52:46.694 INFO http enabling experimental HTTP/3 listener {“addr”: “:443”}

2022/01/02 06:52:46.694 DEBUG http starting server loop {“address”: “[::]:443”, “http3”: true, “tls”: true}

2022/01/02 06:52:46.694 DEBUG http starting server loop {“address”: “[::]:80”, “http3”: false, “tls”: false}

2022/01/02 06:52:46.694 INFO http enabling automatic TLS certificate management {“domains”: [“localhost”]}

2022/01/02 06:52:46.695 WARN tls stapling OCSP {“error”: “no OCSP stapling for [localhost]: no OCSP server specified in certificate”}

2022/01/02 06:52:46.695 DEBUG tls.cache added certificate to cache {“subjects”: [“localhost”], “expiration”: “2022/01/02 18:20:52.000”, “managed”: true, “issuer_key”: “local”, “hash”: “4ef5417e5c6a2e8a065b5ceaa4727f74c7516a406a0fe848881dc309bb8671b7”, “cache_size”: 1, “cache_capacity”: 10000}

5. What I already tried:

I checked with my chrome browser, for other websites it could able to handle h3 requests

6. Links to relevant resources:

Try with a http3 enabled curl: curl -I --http3 https://localhost

I tried with Curl

curl --http3 https://example.com/

curl: option --http3: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
 ~ % curl -I --http3 https://localhost

I guess I dont have curl version which supports http.

I need to load the page in browser,
Why it is not serving as h3 in chrome browser?

Do I have to pass any headers?

Browsers are a bit magic, they have a bunch of heuristics to decide whether they want to use H3 or not. I can’t really answer why it chose not to.

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