Skip to content

Commit c92a55c

Browse files
author
CodeBuddy Attribution Bot
committed
fix(attribution): HTTP 云函数 Skill 缺少路径映射和网关路径处理的关键说明 (issue_mo1hkx69_frhv2z)
1 parent bd20a6a commit c92a55c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

config/source/skills/cloud-functions/references/http-functions.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,29 @@ manageGateway({
143143
});
144144
```
145145

146+
### Path mapping model
147+
148+
Keep the public gateway path and the in-function router path as two different layers.
149+
150+
- `manageGateway(..., path: "/api/hello")` creates the **external** access prefix.
151+
- Your HTTP Function still matches its own internal routes such as `/`, `/health`, `/users`.
152+
- Do **not** rewrite the function router to include the gateway prefix.
153+
154+
Example mapping:
155+
156+
| External URL | Route your HTTP Function should handle |
157+
| --- | --- |
158+
| `https://{domain}/api/hello` | `/` |
159+
| `https://{domain}/api/hello/health` | `/health` |
160+
| `https://{domain}/api/hello/users` | `/users` |
161+
162+
For example, if you expose `path: "/api/httpDemo"`, the function code should normally keep handlers like `app.get("/")` and `app.get("/health")`. Do not change them to `app.get("/api/httpDemo")` or `app.get("/api/httpDemo/health")`.
163+
164+
If the external caller reports a 404, verify these two layers separately:
165+
166+
1. Use `queryGateway(action="getAccess")` to confirm which public path is actually exposed.
167+
2. Check the HTTP Function router to confirm it handles the internal path after the gateway prefix.
168+
146169
Before enabling anonymous access, confirm both of these:
147170

148171
1. The access path exists.

0 commit comments

Comments
 (0)