A Site That Survives LaLiga Blocks
On Sunday, November 1, a little after 13:00 UTC, my website stopped being reachable from most of Spain. Nothing was wrong with it. A football match was about to start, and the country's biggest internet providers had been told to block a list of IP addresses that were carrying pirate streams. Some of those addresses belonged to Cloudflare, and Cloudflare puts thousands of unrelated sites on the same addresses. Mine was one of them.
This happens every weekend there's LaLiga. A Barcelona commercial court upheld LaLiga's right to have Spanish providers block the IPs it names during matches, and dismissed Cloudflare's attempt to annul the ruling. Basque registry Puntu.eus has written about thousands of sites going dark as collateral. I can't change any of that. What I can change is where my sites are standing when the blocks land. At 13:05 the five-minute check saw the block and my sites were back, served straight from my own server, and they went back behind Cloudflare on Tuesday morning without anyone touching anything. The interesting part turned out not to be the switch. It was knowing when to flip it, and especially when to flip it back.
Two ways to be reached
Normally www.pablofr.com resolves to Cloudflare. Visitors talk to Cloudflare's edge, which caches the pages and passes the rest to my VPS. The VPS refuses anyone else: Traefik only lets in Cloudflare's addresses, so nobody can go around the cache and the protection in front of it.
During a block that arrangement is a trap. The ISP drops every packet to the blocked range, so visitors never reach the edge, and the edge is the only thing the VPS will talk to. The way out is to stop sending people to Cloudflare at all for a while: switch the DNS records to DNS-only, so they point straight at the VPS, and open the door on the VPS so it accepts them.
That's what pfrctl cf-failover does, a Go command in my infrastructure tool that a systemd timer runs every five minutes. It has three modes:
Leaving takes three steps, in this order: open the allowlist (otherwise the first direct visitor gets a 403), switch pablofr.com, www, api and the wildcard to DNS-only with a 60-second TTL, then ask the VPS for www over its own IP and check it answers. If it doesn't, the records go straight back behind Cloudflare: a site blocked for some of Spain is better than a site broken for everyone. On every switch I get an email.
Where the data comes from
The VPS is in Germany, so it can't see a Spanish block. Somebody in Spain has to look. ¿Hay ahora fútbol? is a public monitor that tests, live, which IPs each Spanish provider is blocking, and publishes it as one JSON file. The command downloads it with an ETag, so most passes get a 304 and reuse the copy on disk, and ignores it entirely if it's more than 30 minutes old.
It doesn't watch my IPs, it watches my ranges. Cloudflare hands out a slightly different address depending on who asks (the last number changes with the resolver's location: Spain gets .5, the VPS .9), and the blocks hit the whole neighbourhood at once. So the command takes the /24 or /48 around whatever www.pablofr.com resolves to and asks whether any blocked IP falls inside it. Right now that's four ranges, two IPv4 and two IPv6.
How bad it gets: on Sunday, October 25, at 18:25 UTC, the monitor listed 28 blocked IPs inside my four ranges, on all five providers at once.
Leaving is easy, coming back is not
The tempting rule is to come back as soon as the monitor shows nothing blocked. It's wrong, because blocks lift and return within the same match, and every round trip costs something: when a record goes back to proxied, Cloudflare needs about two minutes to switch on TLS for it, and during those two minutes the domain fails. So the rule is to wait 30 minutes with nothing blocked before trusting it, and then 10 more after reconnecting before closing the door, because resolvers keep handing out the VPS's address until the old answer expires.
cfoRearm = 30 * time.Minute // los bloqueos se levantan y vuelven: margen antes de fiarse
cfoDNSDrain = 10 * time.Minute // los registros con proxy tienen TTL 300 s; esto lo cubre con margen
cfoStale = 30 * time.Minute // datos de hayahora más viejos que esto no deciden nadaThe comments are in Spanish because the code is mine. The first line says it plainly: blocks lift and come back, give it margin before trusting it.
Here is what the journal on the VPS shows since it started keeping these lines, from October 25 to this morning (times in UTC):
That's more than 75 hours served directly in sixteen days. Every one of the five switches the journal saw from start to finish passed the origin check on the first try.
The Nov 1 row is the odd one, and the most honest. By 23:25 that Sunday the block had shrunk from 26 IPs to one, which the monitor kept listing as blocked on Masmovil and Orange until 08:05 on Tuesday: 32 hours and 40 minutes for a single address. Was it really still blocked, or was the monitor's data stale for that one IP? I can't tell from here, and the command doesn't try to guess. One blocked IP inside my range is a block. Serving from the VPS costs me the cache and the protection, not the visitors, so being wrong in that direction is cheap.
A probe at home
There's a gap in the monitor's view. Providers don't always cut a range; sometimes they throttle it, and the site takes seconds to load instead of failing. The monitor reports cuts, not slowness. So I put a probe on a Raspberry Pi at home, on a Spanish connection, that requests Cloudflare's trace page through each of my four ranges every 20 seconds, alongside two control sites nobody blocks. A range is slow when its median is over 800 ms and more than eight times the controls'.
On October 25 it saw exactly that: while two IPs failed outright, two more answered with medians between 801 and 1,405 ms, against 50 to 54 ms for the controls.
It also taught me not to trust it, on the day I built it. On October 14, with no football on, the site took between 0.4 and 8 seconds to load from home while the controls answered in 40 to 65 ms. That is precisely what throttling looks like. It was my home network.
So the probe never takes the site off Cloudflare. Only the monitor, which watches every provider, can do that. The probe can only hold the return: while it still sees my ranges blocked or slow, the command stays direct, and the 30 quiet minutes count from the last block either of them saw. On Tuesday, November 3, from 21:20 to 21:30 UTC, the probe saw my ranges at 800 to 900 ms with the monitor reporting nothing. The site stayed behind Cloudflare, which is the rule doing its job.
That last row is for when a source goes quiet in the middle of a block. Coming back on the word of the one that's left would mean trusting half the picture, so the command waits up to four hours for the silent one before going back on the other's say-so. If the monitor is down while the site is behind Cloudflare, nothing changes at all.
Everything Cloudflare serves by itself
Switching records to DNS-only covers whatever my VPS serves. It doesn't cover what Cloudflare serves on its own, with no server of mine behind it: the images and downloads in an R2 bucket on assets.pablofr.com and downloads.pablofr.com, and another site I run that is a Cloudflare Worker. Their records are read-only; there's nothing to point at the VPS.
So during a block the command detaches those domains from their bucket or Worker and gives them an ordinary record pointing at the VPS, and Traefik serves them by fetching from Cloudflare through a second hostname the failover never touches. The VPS isn't in Spain, so it isn't blocked. The Worker's second hostname answers 404 unless the request carries a shared secret, which only Traefik adds, so it can't be used to go around the real site.
The certificates were the hidden step. Traefik normally gets certificates from Let's Encrypt by itself, but it wouldn't for these names, because the default certificate it holds for *.pablofr.com (Cloudflare's own Origin CA, trusted by Cloudflare and by no browser) already "covers" them. During a block, browsers would get that one. A small script with lego now requests real certificates for those names through a DNS challenge, every day, whether there's football or not.
The deploy that closed the door
The last bug was mine. My infrastructure repo deploys with a git reset --hard on the VPS. The open allowlist is a modified file in that repo, so a deploy in the middle of a match quietly closed the door again, and the site went from served directly to refusing everyone.
Two things fix it. Every pass reconciles the allowlist and the records with the mode in its state file, whatever they currently say. And a systemd path unit watches that file and runs the command the moment it changes, so a reset is undone in seconds instead of up to five minutes. The journal shows 13 of those reopenings during blocks since October 25, eight of them on that first Sunday alone.
None of this makes the blocks less absurd: a personal blog goes dark because a football club is chasing streams on a neighbouring address. But the fix doesn't depend on anyone being reasonable. It depends on a public monitor someone else runs, a probe that's allowed to say "wait" and never "go", and a rule I wish I'd written first: leave fast, come back slowly, and never on half the picture.
Related articles
Same site, same 28 days: 229 visitors, 30,121 visits, 7 clicks. How one command joins five analytics tools into a weekly report, critical first.
How pablofr.com is built: three services, Postgres, Meilisearch and Redis, one work queue and a lot of SSE. A personal site over-engineered on purpose.