Enabling HTTP/3 on the origin server exposed three pitfalls: Ubuntu’s bundled nginx lacks QUIC support; switching to the official package also removed the CrowdSec nginx bouncer, leaving detection active but blocking disabled; and switching to a firewall bouncer risked blocking the CDN.
Before upgrading, check module dependencies, simulate the installation, and back up the existing configuration. Restart afterward. To avoid accidental blocks, whitelist CDN addresses and your own machines before configuring realip. HTTP/3 also requires configuring QUIC, allowing UDP port 443 through both cloud and host firewalls, and testing that it actually works.
A firewall can block direct traffic, but it cannot stop attacks forwarded through a CDN. Those still require L7 filtering or blocking at the CDN.
tar -czf /root/nginx-backup-$(date +%F-%H%M%S).tar.gz /etc/nginx /etc/crowdsec/bouncers /etc/crowdsec/config.yaml
dpkg-query -W > /root/packages-before-nginx-upgrade.txtcurl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --dearmor --yes -o /usr/share/keyrings/nginx-archive-keyring.gpg
. /etc/os-release
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/ubuntu ${VERSION_CODENAME} nginx" > /etc/apt/sources.list.d/nginx-org.list
printf 'Package: *\nPin: origin nginx.org\nPin-Priority: 900\n' > /etc/apt/preferences.d/99nginx
apt update && apt-cache policy nginxnginx -V 2>&1 | grep -o -- '--with-http_v3_module' # 有输出才算成功
nginx -t
systemctl restart nginx # 换了二进制要 restart,reload 不够systemctl status crowdsec
cscli metrics show acquisition # 日志还在被读取
cscli decisions list # 决策还在产生
cscli bouncers list # nginx-bouncer 已经不再拉取apt install crowdsec-firewall-bouncer-nftables
systemctl status crowdsec-firewall-bouncer
cscli bouncers list # 多出一个 cs-firewall-bouncer,并且在持续 pull
nft list tables # 能看到 ip crowdsec 和 ip6 crowdsec6 两张表curl -fsS https://api.fastly.com/public-ip-list -o /tmp/fastly.json
{
cat <<'EOF'
name: my/cdn-whitelist
description: "Never ban CDN edges or own infra"
whitelist:
reason: "CDN edge / own infra"
ip:
- "203.0.113.10"
cidr:
EOF
jq -r '.addresses[], .ipv6_addresses[] | " - \"" + . + "\""' /tmp/fastly.json
} > /etc/crowdsec/parsers/s02-enrich/my-whitelist.yaml
systemctl reload crowdsec{
jq -r '.addresses[], .ipv6_addresses[] | "set_real_ip_from " + . + ";"' /tmp/fastly.json
echo 'real_ip_header X-Forwarded-For;'
echo 'real_ip_recursive on;'
} > /etc/nginx/fastly-realip.confcscli decisions add --ip <手机IP> --duration 5m --reason "bouncer test"
sleep 15 # bouncer 默认每 10 秒拉取一次决策
nft list ruleset | grep '<手机IP>'server {
listen 443 ssl;
listen [::]:443 ssl;
listen 443 quic reuseport; # reuseport 在同一地址端口上全局只能写一次
listen [::]:443 quic reuseport;
http2 on;
http3 on;
server_name origin.example.com;
# 证书、反代等配置不变
add_header Alt-Svc 'h3=":443"; ma=86400' always;
}nginx -t && systemctl reload nginx
ss -lunp | grep ':443' # 应该能看到 nginx 在监听 UDP 443
curl -I --http3-only https://origin.example.com/ # 需要 curl 本身支持 HTTP/3
Background
I set out to enable HTTP/3 on my origin server and ended up uncovering three issues: Ubuntu’s packaged nginx doesn’t support QUIC; switching to the official package also removes CrowdSec’s nginx bouncer; and the firewall bouncer used as a workaround can accidentally block CDN nodes. This post walks through the migration in the order I ran into each snag.
Component
Before migration
After migration
Machine
Oracle Cloud, ARM64, Ubuntu 24.04 (noble)
Unchanged
nginx
1.24.0-2ubuntu7.18 (Ubuntu repository)
1.30.6-1~noble (official nginx.org repository)
HTTP/3
Unsupported
Supported (`--with-http_v3_module`)
CrowdSec bouncer
crowdsec-nginx-bouncer (Lua)
crowdsec-firewall-bouncer (nftables)
CDN in front
Fastly origin pull
Unchanged
All domains and IP addresses below are examples: the origin server is origin.example.com, and the frontend machine is 203.0.113.10.
Issue 1: invalid parameter "quic"
After adding listen 443 quic; to the site configuration, nginx -t immediately fails with an error:
The reason is that nginx 1.24 in the Ubuntu 24.04 repository was built without the HTTP/3 module. HTTP/3 was introduced in nginx 1.25.0 and requires the --with-http_v3_module build option. You can check with:
If the only output is --with-http_v2_module, this binary does not support HTTP/3. Changing the config or opening ports won’t help—you need an nginx build that includes the module.
One more thing: after removing the two quic lines, http2 on; will then report unknown directive "http2". The standalone http2 directive was added in 1.25.1; 1.24 only recognizes the older listen ... http2 syntax.
Pre-upgrade checks
Before switching packages, check whether you rely on any Ubuntu-specific dynamic modules. I did, and they really were removed as part of the upgrade.
The output shows libnginx-mod-http-lua and libnginx-mod-http-ndk, which were built for Ubuntu’s 1.24 release and can’t be loaded into the official 1.30 build.
The candidate version is 1.30.6-1~noble, from nginx.org; a package is available for ARM64.
Upgrade process
When you run apt install nginx, apt first removes packages that conflict with the official package, then installs 1.30.6:
Note that the first one is crowdsec-nginx-bouncer. It depends on the Lua module, so it gets removed too. More on that in the next section.
During installation, a conffile prompt asks whether /etc/nginx/nginx.conf should be replaced with the new version.Choose N here to keep your own version. The official package’s bundled nginx.conf only includes conf.d/*.conf; it doesn’t load sites-enabled/*. If you choose Y, every site under sites-enabled will stop working.
After installation:
nginx -t succeeds, but you may see two warnings:
Also, apt autoremove will suggest removing libluajit2-5.1-2 and lua-resty-lrucache. If you plan to build Lua modules yourself later, don’t remove them yet.
Issue 2: CrowdSec detects threats but doesn’t block them
After the upgrade, the CrowdSec engine itself works perfectly: it still reads nginx logs and creates ban decisions, but there’s no longer any component enforcing them. You can see this with cscli bouncers list: the nginx-bouncer’s Last API pull is stuck at the time of the upgrade.
There was another issue I hadn’t realized: the nginx bouncer only blocks HTTP requests. That means IPs flagged for SSH brute-force attacks by crowdsecurity/ssh-slow-bf were never actually blocked.
The fix is to install the firewall bouncer. It drops packets at the nftables layer, independently of the nginx version, so it can cover SSH and UDP 443 as well:
To restore the old L7 blocking, you have two options: use --with-compat to build NDK and Lua dynamic modules for 1.30.6 yourself, or switch to OpenResty with crowdsec-openresty-bouncer. The first option means rebuilding every time nginx is upgraded.
Issue 3: the firewall bouncer can accidentally block CDN nodes
Switching to the firewall bouncer introduces a new risk: if the logs contain CDN node IPs, CrowdSec may identify a CDN node as an attacker and block it at the firewall, cutting off that node’s connection to the origin. First, check which IPs appear most often in each site’s logs:
For one site, the top entries were all Fastly address ranges (167.82.x, 140.248.x, and 23.235.x). Nearly 99% of that site’s requests were attributed to these IPs, so sooner or later one would trigger a ban. The top IP for another site was my own frontend machine, which calls an API while doing SSR.
There are two steps to fix this.
Step 1: add a safety net with an allowlist. Generate the list of ranges using Fastly’s official API, then add your own machines:
Step 2: configure realip so the logs record the actual client IP.
Then, in each site’s server {} block, add include /etc/nginx/fastly-realip.conf;. I chose X-Forwarded-For with real_ip_recursive on because it trusts forwarded addresses only when they come from Fastly ranges, and ignores headers spoofed by clients.
Before deploying, make sure no CDN nodes have already been banned:cscli decisions list | grep -E '23\.235\.|140\.248\.|167\.82\.|151\.101\.'. If any have, remove the decisions with cscli decisions delete --ip <IP>.
One important caveat: the firewall can’t block attackers whose traffic comes through a CDN, because the packets actually come from CDN nodes. That requires an L7 bouncer or blocking at the CDN.
Verify that bans are taking effect
First, check that existing ban decisions have been applied to nftables. Pick any banned IP and search for it in the ruleset; if it’s there, synchronization is working:
Then test with an IP you control. For example, turn off Wi-Fi on your phone and visit ifconfig.me to see its public IP.Never ban the IP you’re currently using for SSH. If you do lock yourself out, use the serial console in the Oracle control panel to log in and remove the ban.
Next, use your phone to connect directly to the origin (not through the CDN). If the page keeps loading until it times out, the ban is working. The firewall drops packets outright, so you won’t see a 403. Remember to remove the ban afterward:cscli decisions delete --ip <手机IP>. If your phone’s public IP is IPv6, use --range <前缀>::/64 to ban the entire /64 prefix.
Enable HTTP/3
Once nginx is replaced with a build that includes --with-http_v3_module, enabling HTTP/3 takes just three changes: site configuration, allowing UDP 443, and verification.
reuseport can only be specified in one server block, usually the default site. Other sites should use only listen 443 quic;; otherwise, nginx -t will report duplicate listen options.
Allow UDP 443 through the firewall. On Oracle Cloud, this involves two layers:
Verify:
If there’s a CDN in front of the origin, enabling H3 only lets clients connecting directly to the origin use QUIC. Whether the CDN uses HTTP/3 to connect to the origin depends on the CDN’s own support.
Lessons learned
Remaining issues