← Notes

html.contact Used to Be a Porn Site

How I retired an adult site's old URLs without breaking html.contact forms, APIs, or normal Cloudflare routing.

html.contact had a problem before it had customers. The domain had been used for adult content.

Old search results and dead URLs do not disappear when a new product launches. They keep getting crawled. A normal 404 Not Found says a page is missing. I wanted a clearer answer: the old content was removed on purpose and will not return.

That answer is 410 Gone.

The Cloudflare problem

Returning a 410 was easy in local development. Production was harder.

Cloudflare can serve a static 404 before the application Worker sees the request. If that happens, the correct response code never reaches the crawler.

I added a small route matcher at the start of the Worker. It catches the retired content families before Astro handles the request. The same rule also runs in middleware as a second guard.

I did not use a wildcard Worker route. That could have changed how forms, APIs, and normal assets behaved. Cloudflare runs the Worker first only for the retired route families.

A deploy is not proof

A successful deploy does not mean the custom domain serves the new version at once. Edge caches and propagation can create a short delay.

The release check sends a unique request to a retired URL and waits for a real 410. It also sends a safe request through the public form path. That second request proves the cleanup did not break the product.

The check retries for up to 60 seconds. A persistent wrong response stops the release.

The lesson is simple. Domain history becomes part of the product. Handle it at the routing layer, make the response precise, and prove that the cure did not damage the app.

Create a real HTML form on html.contact.