@kne/fastify-app-manager 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/libs/utils/pathRewrite.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -872,7 +872,7 @@ data: {"name":"demo","ts":1791456608533,...}
|
|
|
872
872
|
| 应用不存在 | `/app/{name}` 下找不到应用时返回 404「应用不存在」页(带返回首页)或 JSON(`appStatus: 'missing'`);`pathPrefix` 之外以及未绑定的域名仍交给宿主路由 |
|
|
873
873
|
| Location | 相对路径前缀补上 `/app/{name}` |
|
|
874
874
|
| Set-Cookie | `Path=/` 改为 `Path=/app/{name}` |
|
|
875
|
-
| Body | 对文本类 Content-Type,将 `"/static/`、`"/api/`、`"/account/` 等前缀改写;有 `content-encoding`
|
|
875
|
+
| Body | 对文本类 Content-Type,将 `"/static/`、`"/api/`、`"/account/` 等前缀改写;有 `content-encoding` 时跳过;JS 脚本与 `text/event-stream`(SSE 不结束的流)原样流式透传 |
|
|
876
876
|
|
|
877
877
|
##### 日志切分与归档
|
|
878
878
|
|
|
@@ -31,7 +31,10 @@ const TEXTUAL_TYPES = /text\/|json|xml|svg/i;
|
|
|
31
31
|
// 前端脚本已按注入的 runtimePublicUrl / runtimeApiUrl 自行拼前缀(如 axios baseURL + '/api/...'),再改写会得到 /app/x/app/x/api
|
|
32
32
|
const SCRIPT_TYPES = /javascript|ecmascript/i;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
// SSE 是不结束的流,读完再改写会让客户端一直收不到响应
|
|
35
|
+
const STREAM_TYPES = /text\/event-stream/i;
|
|
36
|
+
|
|
37
|
+
const shouldRewriteBody = contentType => TEXTUAL_TYPES.test(contentType || '') && !SCRIPT_TYPES.test(contentType || '') && !STREAM_TYPES.test(contentType || '');
|
|
35
38
|
|
|
36
39
|
const rewriteBody = (body, mountPrefix, prefixes = ['/static', '/api', '/account']) => {
|
|
37
40
|
if (!body || !mountPrefix) {
|