I'm trying to setup an testing environment for http3 just for learning.
What I did so far:
- Created a real let's encrypt certificate with dns-01
- Compiled node.js with the experimental CUIC flag
- Compiled curl with http3 support
I created a script with the content of the example:
'use strict';
const key = getTLSKeySomehow();
const cert = getTLSCertSomehow();
const { createQuicSocket } = require('net');
// Create the QUIC UDP IPv4 socket bound to local IP port 1234
const socket = createQuicSocket({ endpoint: { port: 1234 } });
socket.on('session', async (session) => {
// A new server side session has been created!
// The peer opened a new stream!
session.on('stream', (stream) => {
// Let's say hello
stream.end('Hello World');
// Let's see what the peer has to say...
stream.setEncoding('utf8');
stream.on('data', console.log);
stream.on('end', () => console.log('stream ended'));
});
const uni = await session.openStream({ halfOpen: true });
uni.write('hi ');
uni.end('from the server!');
});
// Tell the socket to operate as a server using the given
// key and certificate to secure new connections, using
// the fictional 'hello' application protocol.
(async function() {
await socket.listen({ key, cert, alpn: 'h3-25' });
console.log('The socket is listening for sessions!');
})();
Just for future readers the functions getTLSKeySomehow()
and getTLSCertSomehow()
can be replaced by this:
const fs = require("fs")
const key = fs.readFileSync('privkey.pem')
const cert = fs.readFileSync('cert.pem')
Then I tried to open the webpage by enableding http3 in Firefox with the feature-flag network.http.http3.enabled
enabled in about:config
. With the address https://my.dev.domain.name:1234/
but this didn't work.
Using curl didn't work ether, might be worth noting that I'm using WSL on Windows 10. Accessing the same url on curl times out everytime. Just to check that my setup is fine: I can verify that Firefox and curl can access www.google.com flawless via http3.
When I implement a second http2 endpoint with the same key this works fine without any certificate warnings.
How can I debug what I'm doing wrong?