Files
pyGoEdge-UserPanel/reference/goedge 文档/HTTPRewriteRuleService.md
2025-11-18 03:36:49 +08:00

92 lines
1.7 KiB
Markdown
Raw Permalink 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.
# HTTPRewriteRuleService
> 重写规则服务
---
## createHTTPRewriteRule
> 创建重写规则
- 角色:`admin`, `user`
- HTTP`POST https://backend.dooki.cloud/HTTPRewriteRuleService/createHTTPRewriteRule`
- RPC`rpc createHTTPRewriteRule (CreateHTTPRewriteRuleRequest) returns (CreateHTTPRewriteRuleResponse);`
**请求对象 (`CreateHTTPRewriteRuleRequest`)**
```json
{
"pattern": "string",
"replace": "string",
"mode": "string",
"redirectStatus": "int32",
"isBreak": "bool",
"proxyHost": "string",
"isOn": "bool // 是否启用",
"withQuery": "bool",
"condsJSON": "bytes"
}
```
**响应对象 (`CreateHTTPRewriteRuleResponse`)**
```json
{
"rewriteRuleId": "int64"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/HTTPRewriteRuleService/createHTTPRewriteRule" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## updateHTTPRewriteRule
> 修改重写规则
- 角色:`admin`, `user`
- HTTP`POST https://backend.dooki.cloud/HTTPRewriteRuleService/updateHTTPRewriteRule`
- RPC`rpc updateHTTPRewriteRule (UpdateHTTPRewriteRuleRequest) returns (RPCSuccess);`
**请求对象 (`UpdateHTTPRewriteRuleRequest`)**
```json
{
"rewriteRuleId": "int64",
"pattern": "string",
"replace": "string",
"mode": "string",
"redirectStatus": "int32",
"isBreak": "bool",
"proxyHost": "string",
"isOn": "bool // 是否启用",
"withQuery": "bool",
"condsJSON": "bytes"
}
```
**响应对象 (`RPCSuccess`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/HTTPRewriteRuleService/updateHTTPRewriteRule" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---