Killing off my last Windows Server: having Claude help me move IIS to Caddy
The last Windows server in my lab is finally on its way out. I have been upgrading this IIS box since the ye old days of NT4 and somehow I still had several websites running on it that I moved to a Ubuntu VM with Caddy. The sites belong to a few small businesses, and the one rule was that nobody notices. The old server VM was kept running, so I could compare the two side by side.
I had Claude assist me by giving it access to the servers, the firewall and DNS, and it did most of the typing while I made the decisions. That makes this part adventure story: it was very good at some things and confidently wrong about others, and the second kind is less stressful when you know you have backups offline.
Caddy (I thought people still used Apache?)
It fetches its own HTTPS certificates, renews them automatically, and upgrades seamlessly.
1. Linux is case sensitive, and that's an issue, Linux cares about capital letters. IIS doesn't.
On Windows, /Catalog/Widget_Pricing.html and /catalog/widget_pricing.html are the same file. On Linux one of them is a 404. Old sites are full of links, bookmarks and Google results with the "wrong" capitalization.
Before calling it done I asked Claude to go hard at the move and find every mistake a customer could notice before they did. Claude looked at a year of real requests out of the IIS logs and asked the old server and the new one the same 3,500 URLs. About 2 percent of a year's hits would have turned into 404s.
The fix that stuck was a case-insensitive filesystem. ext4 can do it, per directory: make the filesystem with mkfs.ext4 -O casefold -E encoding=utf8, flag the empty top folder with chattr +F, and everything under it inherits. Two gotchas: the folder has to be empty when you flag it (so delete lost+found), and it only works on a filesystem created that way, so I used a disk image mounted where the sites live.
2. This was fun, IIS doesn't send a character set, my new web server does.
One of my customers loves a ® and a ©. Their pages are full of trademark and copyright symbols: in titles, in product names, in footers, even in image file names. It turns out that matters a lot when you change web servers.
It started with a screenshot: a � where a ® should be. IIS sent plain text/html; Caddy added charset=utf-8. The pages were really windows-1252, so the header won, the ® broke, and so did every image with one in its file name.
About 300 of that site's 433 pages were old-style; no other site had any. Two lines in its block of /etc/caddy/Caddyfile put the plain text/html header back:
@legacyhtml path *.htm *.html / */ header @legacyhtml >Content-Type "text/html"
The > makes it override the header file_server sets. The / and */ catch directory pages like the home page, which my first version missed.
3. Don't let Linux serve up your source code
ASP, .config and .asa files sit in the folder and Linux serves them as plain text. I made the server return 404 for them. Also check the logs for which extensions got real hits. One old ASP site search was the biggest thing that stopped working (about 5,000 hits a year), and that is a conversation with the site owner, not a setting.
4. Spaces are plus signs in IIS logs
If you replay old log lines, /My+Photo.jpg is /My Photo.jpg. Decode the plus signs, or half your test fails for no reason.
5. Taking over an IP address
I moved the public address from the old server to the new one so no DNS had to change. Certificates need care too. Let's Encrypt validates over the public address, so a name can't get a real certificate until the address actually reaches the new server. I ran the sites on Caddy's internal test certificates first and deleted one line right after the switch. One name needed a second reload because Let's Encrypt briefly claimed the certificate didn't exist.
6. FTP: copy the experience, not just the files
IIS FTP isolates each user in their own folder. On Linux that is a chroot per user, plus bind mounts to put the right site folders in each one. I compared the old and new login views entry by entry (name, size, date) until all 424 entries matched. Two things I only caught by comparing: empty folders are easy to lose when you copy files, and so are modified times.
7. The boring ones
- TLS 1.0 and 1.1 are off by default now. Very old browsers will fail. I decided that was fine.
- IIS's default 404 page shows the full path of the folder on the server to every visitor. A blank 404 leaks nothing.
- Reboot the new server before you call it done. Mine came back in 40 seconds with every mount in place.
Where Claude earned its keep
- It looked before it touched. The first job was a read-only audit of the old server. It found abandoned sites, unused application pools and a steady stream of people guessing FTP passwords.
- It copied everything with a checksum. Every file of every site was hashed on both sides, and the old copy of each site was switched off the moment it moved.
- It built tests I would not have written. The log replay, the side-by-side comparison of old and new server and the headless browser run all came from Claude, and they found the case and character-set problems above.
- It cleaned up after itself. Backups for the new server, monitors, a copy of the old server's FTP history on the NAS, and notes in a repository so the next person (probably me, in a year) can see why things are the way they are.
- At the end it argued against itself. I asked for an adversarial review of the whole move. It listed what a customer could still notice, and it found a test edit sitting live on a customer's home page that nobody had caught.
Where Claude got it wrong
This is the part I would want to read if I were about to do the same thing.
- It opened a firewall rule far too wide on day one. Allow everything into my house. I saw it in a screenshot of the firewall and was not amused. It is now a hard rule that Claude never creates an allow-all rule, and if I ever need one, i'll make that myself.
- It blocked its own security scanner. The automatic block list is built from addresses that only fail logins. My own vulnerability scanner fails logins on purpose, so it ended up on the list and was shut out of the whole network for hours before Claude caught it, just ahead of the scan's nightly run.
- It said "verified" when it meant "loads". The sites loaded, the files matched, and the real problems (case, character sets) only showed up after the move, when it replayed a year of traffic. Green checks are not proof.
- It treated questions as orders. I asked whether it could change a stats report to show the last month. It changed my live stats.
- It heard "lets finish the migration" and started toward turning the old server off. It was still serving real customers. I stopped it. The new rule is one named step at a time, with me saying go.
- It tried to park a gigabyte of logs on the production server on the way to the NAS. I had asked for the NAS. I stopped it, and it deleted the copy.
None of those cost a customer anything, mostly because I kept the old server running, kept backups and made it ask before anything that could not be undone.