Description
When receiving writes in the passive region, either forward via an authenticated tunnel to the active region or return a 302 with the active URL. Reduces failover data loss window.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
cmd/server/main.go, internal/routes/routes.go
- Prevent write loops with a hop header
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/cross-region-write-forward
- Implement changes
- Add
internal/middleware/region_router.go
- Config
REGION_ROLE=passive|active
- Trace attribute for forwarded requests
- Validate security and correctness assumptions
Test and commit
- Run tests
go test ./internal/middleware/...
- Cover edge cases
- Active region unreachable: return 503 with helpful body
- Include test output and notes
Example commit message
feat: forward writes from passive region to active
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
When receiving writes in the passive region, either forward via an authenticated tunnel to the active region or return a 302 with the active URL. Reduces failover data loss window.
Requirements and context
cmd/server/main.go,internal/routes/routes.goSuggested execution
git checkout -b feat/cross-region-write-forwardinternal/middleware/region_router.goREGION_ROLE=passive|activeTest and commit
go test ./internal/middleware/...Example commit message
feat: forward writes from passive region to activeGuidelines