Skip to content

Instantly share code, notes, and snippets.

@onpaws
Last active November 14, 2023 06:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onpaws/9162910f300fce8dfd37215436f9f4fb to your computer and use it in GitHub Desktop.
Save onpaws/9162910f300fce8dfd37215436f9f4fb to your computer and use it in GitHub Desktop.
HTTP/3 Sandbox
# Instant HTTP/3 sandbox
# 1. Install a version of curl with HTTP/3 support (e.g. quiche)
# TL,DR: brew install -s https://raw.githubusercontent.com/cloudflare/homebrew-cloudflare/master/curl.rb --HEAD
# More info https://developers.cloudflare.com/http3/intro/curl-brew/
# 2. Stand up an HTTP/3 server. Below is a k8s manifest using nginx + quiche
# Note: In this example, port 8080 is HTTP/1.1 and 8443 is HTTP/3 (also HTTP/2).
# HTTP/1.1 might be useful to confirm you can reach nginx at all. Then you can move onto HTTP/3.
# 3. To make an HTTP/3 request, try this:
# /usr/local/opt/curl/bin/curl -vv --http3 https://1.2.3.4:31234
# Make sure the IP address & port match your server.
# 3a. For Chrome Canary, you may need to launch with certain flags to enable HTTP/3 support:
# /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --enable-quic --quic-version=h3-25 &
# 4. Those of you using Digital Ocean with a single node:
# $ kubectl get svc
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
# kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 14d
# nginx-service NodePort 10.245.69.140 <none> 8443:32261/UDP,8080:31638/TCP 3d21h
# $ kubectl get nodes -o wide
# NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
# pool-zb2de5i4t-vp70 Ready <none> 14d v1.16.6 10.135.145.155 1.2.3.4 Debian GNU/Linux 9 (stretch) 4.19.0-0.bpo.6-amd64 docker://18.9.2
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
type: NodePort
ports:
- name: http3
port: 8443
protocol: UDP
- name: http2
port: 8443
protocol: TCP
- name: http
port: 8080
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
name: nginx
spec:
terminationGracePeriodSeconds: 20
containers:
- name: nginx-container
image: junhochoi/quiche-docker-examples:nginx
imagePullPolicy: Always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment