xfy 4562dd5a7d docs: 添加子目录 AGENTS.md 文档
deepinit 生成的子目录级 AGENTS.md 文件,帮助 AI agents 理解各功能模块:
- docs/config/: advanced, basic, caching, load-balancing, lua, rewriting, security, ssl
- docs/lua/: api-gateway, authentication, caching, dynamic-routing, logging-monitoring, middleware, rate-limiting, websocket

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 10:35:49 +08:00

40 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- Parent: ../AGENTS.md -->
<!-- Generated: 2026-04-23 | Updated: 2026-04-23 -->
# rewriting
## Purpose
URL 重写配置示例目录,包含 rewrite 规则、重定向等 URL 处理配置。
## Key Files
| File | Description |
|------|-------------|
| `rewrite-rules.conf` | URL 重写规则:正则匹配、变量替换、内部重定向 |
| `redirect.conf` | 重定向配置301/302 跳转、域名迁移 |
## For AI Agents
### Working In This Directory
- rewrite 使用正则表达式匹配 URL
- last 表示重写后重新匹配 location
- break 表示重写后直接处理,不再匹配
- redirect 返回 302permanent 返回 301
### Testing Requirements
- 重写规则通过单元测试验证
- 测试正则匹配和变量替换正确性
### Common Patterns
- 正则捕获:`rewrite ^/user/(\d+)$ /profile?id=$1 last`
- 域名迁移:`return 301 https://new.domain.com$request_uri`
- HTTP 转 HTTPS`return 301 https://$host$request_uri`
## Dependencies
### Internal
- `../../../internal/middleware/rewrite/` - 重写中间件实现
- `../../../internal/handler/` - 请求处理器
<!-- MANUAL: -->