[Bug] Rails 8 allow_browser middleware blocks link preview bots with 406 response
Bug Description
Claude assumed the following issue was a blocked IP issue from our Hetzner cloud; and kept cycling through solutions to resolve it when in fact it was: Here's what happened — the short version:
The symptom: iMessage (and other link-preview bots like Slack/Discord/WhatsApp) were getting no preview card when
someone texted a dasha.fm URL. Your OG tags were in order — eccdc18 had even hardened them with og:image:secure_url,
og:image:type, and og:locale. First instinct was that Hetzner or Cloudflare was blocking the preview fetchers by
IP.
The actual cause: Rails 8 ships with allow_browser versions: :modern in ApplicationController. That middleware
inspects the User-Agent and returns HTTP 406 Not Acceptable (rendering public/406-unsupported-browser.html) for
anything it doesn't recognize as a modern browser — and the iMessage/Apple link preview fetcher's UA didn't qualify.
So the fetcher got a 406 + a static HTML fallback page with no og:* tags, and iMessage had nothing to render.
Not an IP block at all. The server was happily answering — just with the wrong response body to anyone whose UA
didn't look like a recent Chrome/Safari/Firefox.
The fix (commit 87e6445):
- Removed allow_browser versions: :modern from app/controllers/application_controller.rb
- Deleted public/406-unsupported-browser.html (the fallback template that had no OG tags)
After that, bots get a normal 200 with the full <head> including OG tags, and iMessage renders the preview card.
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 2.1.119
- Feedback ID: 212e1787-80bf-4f58-b96f-1da7ed12b504
Errors
[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at TWH (/$bunfs/root/src/entrypoints/cli.js:2736:30496)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-24T04:05:34.047Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at TWH (/$bunfs/root/src/entrypoints/cli.js:2736:30496)\n at async L (/$bunfs/root/src/entrypoints/cli.js:6300:11825)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-24T04:05:34.460Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at TWH (/$bunfs/root/src/entrypoints/cli.js:2736:30496)\n at async R (/$bunfs/root/src/entrypoints/cli.js:6300:11019)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-24T04:05:34.462Z"}]This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗