locadot 1.6.0-beta.0 → 1.6.0-beta.1

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/CHANGELOG.md CHANGED
@@ -28,6 +28,7 @@ breaking items below.
28
28
  - Test suite (`pnpm test`) and a `prepublishOnly` build.
29
29
 
30
30
  ### Fixed
31
+ - Upstream `Connection`/`Upgrade` headers are no longer forwarded. Apache sites proxied through locadot kept dropping the connection and lost assets. (BUG-12)
31
32
  - `stop`, `restart` and `kill` now actually stop the proxy. (BUG-01)
32
33
  - A failed start is reported with the log tail and exits 1. (BUG-07)
33
34
  - `update` accepts http targets and `add` accepts https ones. (BUG-03)
package/dist/server.js CHANGED
@@ -65,6 +65,20 @@ async function startCentralProxy() {
65
65
  const stats = new Map();
66
66
  const proxy = http_proxy_1.default.createProxyServer({});
67
67
  proxy.on("error", (err) => logger_1.default.warn(`proxy error: ${err.message}`));
68
+ // Hop-by-hop headers describe the upstream connection, not ours. Apache sends
69
+ // `Connection: Upgrade, close` + `Upgrade: h2`, which made us close the browser's
70
+ // socket after every response (ERR_TOO_MANY_RETRIES on asset-heavy pages).
71
+ proxy.on("proxyRes", (proxyRes) => {
72
+ if (proxyRes.statusCode === 101)
73
+ return;
74
+ const listed = String(proxyRes.headers.connection || "")
75
+ .split(",")
76
+ .map((name) => name.trim().toLowerCase())
77
+ .filter(Boolean);
78
+ for (const name of [...listed, "connection", "keep-alive", "upgrade", "proxy-connection"]) {
79
+ delete proxyRes.headers[name];
80
+ }
81
+ });
68
82
  const info = {
69
83
  pid: process.pid,
70
84
  version: package_json_1.version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locadot",
3
- "version": "1.6.0-beta.0",
3
+ "version": "1.6.0-beta.1",
4
4
  "description": "Secure your local development environment with HTTPS and custom domains like dev.localhost.",
5
5
  "homepage": "https://www.npmjs.com/package/locadot",
6
6
  "main": "dist/index.js",