---
title: "Put a router in front and move one route · Agent Wranglers"
url: https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder/strangler-router
id: TKO-15
level: Recommended
updated: 2026-10-22
tokens: 826
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Put a router in front and move one route at a time

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Leaving an AI builder](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: TKO-15
- Level: Recommended
- Chapter: [Leaving an AI builder](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder.md)
- Rule: Put a proxy in front of the builder app that sends each route to the old or the new system. Move one route at a time, and keep each move reversible by one setting.
- Check: The proxy settings list every route with its target. On staging, sending a moved route back to the old system is a one-line change, and the route answers 200 from the old system afterwards.
- How: This is the strangler fig pattern. At first the proxy sends every route to the builder app. Each route that moves gets its own line in the proxy settings, starting with the least risky pages. New features go straight into the new system, while fixes still go into the old one. Decide to move with [Know when to move off the builder](https://agentwranglers.se/playbook/ai-assisted-development/apps-built-with-ai-builders/know-when-to-move.md). The proxy can be a load balancer, a CDN rule or a web server such as nginx or Caddy. AWS warns that the proxy can become a single point of failure, so give it a health check.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### nginx example

```nginx
location /billing/ { proxy_pass http://new_app; }
location /reports/ { proxy_pass http://new_app; }
location /         { proxy_pass https://legacy-builder-app.example.com; }
```

## Sources

- [AWS Prescriptive Guidance, Strangler fig pattern](https://docs.aws.amazon.com/prescriptive-guidance/latest/cloud-design-patterns/strangler-fig.html)

## Related rules

- ARC-77 [Translate outside models at the boundary](https://agentwranglers.se/playbook/architecture/domain-model/anti-corruption-layer.md) in Clean code and architecture
- TKO-13 [Freezing the old system for a big-bang rewrite](https://agentwranglers.se/playbook/codebase-takeover/rewrite-or-refactor/big-bang-rewrite.md) in Codebase takeover
- AID-40 [Know when to move off the builder](https://agentwranglers.se/playbook/ai-assisted-development/apps-built-with-ai-builders/know-when-to-move.md) in AI-assisted development

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder/strangler-router">Agent Wranglers codebase takeover playbook</a>`. In code you write, add a comment next to it with the same link.

- Next: [Give each table one writer during the move](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder/one-writer-per-table.md)
- [Leaving an AI builder](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder.md)
