DevOps40-70 min
HTTP/2 and HTTP/3 Optimization
Enable HTTP/2 or HTTP/3, remove unnecessary domain sharding, tune compression, and benchmark real request behavior.
NginxCaddyCloudflareTLS
Prerequisites
- A production or staging domain with HTTPS.
- Control over reverse proxy or CDN settings.
- A benchmark page with several static assets.
1
Plan the implementation
Start by choosing the exact page, route, API, or deployment surface you want to improve. A narrow target makes the implementation measurable and easier to verify.
- Write down the current behavior and the user-facing problem it creates.
- Pick one measurable success signal such as bundle size, latency, error rate, security coverage, or UI responsiveness.
- Identify the files, routes, providers, and environment variables involved.
- Create a rollback note before changing production-sensitive configuration.
2
Set up the required tools
Install or configure only the tools needed for this implementation. Keep config close to the feature so future developers can find the moving parts quickly.
Implementation snippet
curl -I --http2 https://example.com
curl -I --http3 https://example.comChecklist
- Dependencies are added to the correct workspace package.
- Environment variables are documented in `.env.example` when needed.
- Local development still starts without production-only secrets.
- The change is small enough to review in one pull request.
3
Implement the core pattern
- Confirm HTTPS is working with a valid certificate.
- Enable HTTP/2 in your proxy or CDN.
- Enable HTTP/3 at the CDN when supported and test fallback behavior.
- Avoid splitting assets across many domains just to increase parallelism.
- Benchmark after enabling protocol changes.
Implementation snippet
server {
listen 443 ssl http2;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
}4
Handle edge cases
Checklist
- HTTP/2 is negotiated for modern browsers.
- Compression works for JavaScript, CSS, HTML, and JSON.
- Legacy clients still receive a working fallback.
- No mixed-content or certificate warnings appear.
5
Verify before production
- Run the app locally and test the normal success path.
- Test one failure path, one empty state, and one slow-network or retry path.
- Run the project build and any related unit or integration tests.
- Check browser console, server logs, and network responses for hidden warnings.
- Document the final behavior, commands used, and any follow-up work.