92 lines
1.7 KiB
Markdown
92 lines
1.7 KiB
Markdown
# 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 '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|