shadok-ai 0.19.42 → 0.19.43
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 +34 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1074,7 +1074,8 @@ travels over `/ws`, and the page itself is static HTML, so a proxy that drops
|
|
|
1074
1074
|
connects. In nginx:
|
|
1075
1075
|
|
|
1076
1076
|
```nginx
|
|
1077
|
-
|
|
1077
|
+
# The WebSocket — the ONLY path that upgrades, and the only one that may wait.
|
|
1078
|
+
location = /ws {
|
|
1078
1079
|
proxy_pass http://127.0.0.1:3789;
|
|
1079
1080
|
proxy_http_version 1.1;
|
|
1080
1081
|
proxy_set_header Upgrade $http_upgrade;
|
|
@@ -1082,10 +1083,29 @@ location / {
|
|
|
1082
1083
|
proxy_set_header Host $host;
|
|
1083
1084
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # see below
|
|
1084
1085
|
proxy_set_header X-Forwarded-Proto $scheme; # Secure cookies
|
|
1086
|
+
# proxy_read_timeout 3600s; # optional, and ONLY here — see "Idle timeout"
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
# Everything else: ordinary requests, ordinary (default, 60s) read timeout.
|
|
1090
|
+
location / {
|
|
1091
|
+
proxy_pass http://127.0.0.1:3789;
|
|
1092
|
+
proxy_http_version 1.1;
|
|
1093
|
+
proxy_set_header Host $host;
|
|
1094
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # see below
|
|
1095
|
+
proxy_set_header X-Forwarded-Proto $scheme; # Secure cookies
|
|
1085
1096
|
client_max_body_size 50m; # match the server's paste limit
|
|
1086
1097
|
}
|
|
1087
1098
|
```
|
|
1088
1099
|
|
|
1100
|
+
Two locations, because the two kinds of traffic want opposite things from the
|
|
1101
|
+
proxy: `/ws` is one long-lived socket that may legitimately stay quiet, and
|
|
1102
|
+
everything under `/` is a short request that should fail fast when the server
|
|
1103
|
+
does not answer. `/ws` is the only WebSocket path the server has, so the
|
|
1104
|
+
`Upgrade`/`Connection` headers — and any long timeout — belong there and nowhere
|
|
1105
|
+
else. Both locations carry the `Host` / `X-Forwarded-*` lines on purpose: each
|
|
1106
|
+
`location` is configured on its own, and the server needs the client address
|
|
1107
|
+
and scheme on the socket as much as on a plain request.
|
|
1108
|
+
|
|
1089
1109
|
**Forward the client address.** An agent authenticates to its own server with a
|
|
1090
1110
|
session key that never expires, so the server accepts that key **only from this
|
|
1091
1111
|
machine, directly** — never from the network, where a key leaked by a
|
|
@@ -1119,8 +1139,19 @@ idle-close a quiet socket (nginx `proxy_read_timeout`, 60s by default;
|
|
|
1119
1139
|
Cloudflare ~100s) — the symptom is a cockpit that keeps flashing
|
|
1120
1140
|
"reconnecting…" even though nothing is wrong. The server sends a WebSocket ping
|
|
1121
1141
|
every 25s (tunable with `SHADOK_WS_PING_MS`) to keep the connection warm, so no
|
|
1122
|
-
proxy change is normally needed
|
|
1123
|
-
|
|
1142
|
+
proxy change is normally needed — nginx's default 60s is already more than
|
|
1143
|
+
twice the ping interval. If your proxy still cuts it, raise `proxy_read_timeout`
|
|
1144
|
+
above the ping interval **in `location = /ws` only, never in `location /`**.
|
|
1145
|
+
|
|
1146
|
+
A long read timeout is right for a resting agent's silent socket and wrong for
|
|
1147
|
+
everything else. On a plain `GET`, it is how long the proxy keeps holding a
|
|
1148
|
+
request the server never answers — and the browser holds its end for just as
|
|
1149
|
+
long. A browser opens only about six HTTP/1.1 connections to one host, so a
|
|
1150
|
+
handful of unanswered requests is enough to occupy them all and freeze that
|
|
1151
|
+
cockpit's own updates for the whole timeout, while the proxy and the server
|
|
1152
|
+
keep those connections open too. With the default, the same failure clears in a
|
|
1153
|
+
minute. If your `location /` carries a raised `proxy_read_timeout` today, move
|
|
1154
|
+
it to `location = /ws`.
|
|
1124
1155
|
|
|
1125
1156
|
**Sleep / wake / network blips.** When the machine comes back (an `online`
|
|
1126
1157
|
event, the tab becoming visible, a back/forward-cache restore), the cockpit
|