@adobe/aem-cli 16.10.46 → 16.11.0
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 +14 -0
- package/package.json +2 -2
- package/src/server/HelixProject.js +5 -0
- package/src/server/HelixServer.js +7 -0
- package/src/server/utils.js +16 -9
- package/src/up.cmd.js +7 -1
- package/src/up.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [16.11.0](https://github.com/adobe/helix-cli/compare/v16.10.47...v16.11.0) (2025-09-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **up:** proxy all cookie and set-cookie headers ([b1d3eb2](https://github.com/adobe/helix-cli/commit/b1d3eb2c12c19e36fcd922a274ff487be4e07d53))
|
|
7
|
+
|
|
8
|
+
## [16.10.47](https://github.com/adobe/helix-cli/compare/v16.10.46...v16.10.47) (2025-09-02)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-shared-indexer to v2.2.5 ([#2579](https://github.com/adobe/helix-cli/issues/2579)) ([b5fb1bc](https://github.com/adobe/helix-cli/commit/b5fb1bc482c7a8e8ca8fd5aad0e4e3ef95952354))
|
|
14
|
+
|
|
1
15
|
## [16.10.46](https://github.com/adobe/helix-cli/compare/v16.10.45...v16.10.46) (2025-08-30)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aem-cli",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.11.0",
|
|
4
4
|
"description": "AEM CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@adobe/helix-log": "7.0.0",
|
|
44
44
|
"@adobe/helix-shared-config": "11.1.9",
|
|
45
45
|
"@adobe/helix-shared-git": "3.0.20",
|
|
46
|
-
"@adobe/helix-shared-indexer": "2.2.
|
|
46
|
+
"@adobe/helix-shared-indexer": "2.2.5",
|
|
47
47
|
"camelcase": "8.0.0",
|
|
48
48
|
"chalk-template": "1.1.0",
|
|
49
49
|
"chokidar": "4.0.3",
|
|
@@ -34,6 +34,7 @@ export class HelixServer extends BaseServer {
|
|
|
34
34
|
this._enableLiveReload = false;
|
|
35
35
|
this._app.use(compression());
|
|
36
36
|
this._autoLogin = true;
|
|
37
|
+
this._cookies = false;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
withLiveReload(value) {
|
|
@@ -46,6 +47,11 @@ export class HelixServer extends BaseServer {
|
|
|
46
47
|
return this;
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
withCookies(value) {
|
|
51
|
+
this._cookies = value;
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
async handleLogin(req, res) {
|
|
50
56
|
// disable autologin if login was called at least once
|
|
51
57
|
this._autoLogin = false;
|
|
@@ -205,6 +211,7 @@ export class HelixServer extends BaseServer {
|
|
|
205
211
|
siteToken: this._siteToken,
|
|
206
212
|
loginPath: LOGIN_ROUTE,
|
|
207
213
|
autoLogin: this._autoLogin,
|
|
214
|
+
cookies: this._cookies,
|
|
208
215
|
});
|
|
209
216
|
} catch (err) {
|
|
210
217
|
log.error(`${pfx}failed to proxy AEM request ${ctx.path}: ${err.message}`);
|
package/src/server/utils.js
CHANGED
|
@@ -254,14 +254,16 @@ window.LiveReloadOptions = {
|
|
|
254
254
|
headers.authorization = `token ${opts.siteToken}`;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
257
|
+
if (!opts.cookies) {
|
|
258
|
+
// only pass through hlx-auth-token cookie
|
|
259
|
+
const cookies = cookie.parse(headers.cookie || '');
|
|
260
|
+
delete headers.cookie;
|
|
261
|
+
const hlxAuthToken = cookies['hlx-auth-token'];
|
|
262
|
+
if (hlxAuthToken) {
|
|
263
|
+
headers.cookie = new URLSearchParams({
|
|
264
|
+
'hlx-auth-token': hlxAuthToken,
|
|
265
|
+
}).toString();
|
|
266
|
+
}
|
|
265
267
|
}
|
|
266
268
|
|
|
267
269
|
delete headers.connection;
|
|
@@ -278,8 +280,13 @@ window.LiveReloadOptions = {
|
|
|
278
280
|
const level = utils.status2level(ret.status, true);
|
|
279
281
|
ctx.log[level](`[${id}] Proxy ${req.method} request to ${url}: ${ret.status} (${contentType})`);
|
|
280
282
|
|
|
281
|
-
// because fetch decodes the response, we need to reset content encoding and length
|
|
282
283
|
const respHeaders = Object.fromEntries(ret.headers.entries());
|
|
284
|
+
// multiple Set-Cookie headers need special handling
|
|
285
|
+
// https://www.npmjs.com/package/node-fetch#extract-set-cookie-header
|
|
286
|
+
const setCookieValues = ret.headers.raw()['set-cookie'];
|
|
287
|
+
if (setCookieValues?.length) {
|
|
288
|
+
respHeaders['set-cookie'] = setCookieValues;
|
|
289
|
+
}
|
|
283
290
|
delete respHeaders['content-encoding'];
|
|
284
291
|
delete respHeaders['content-length'];
|
|
285
292
|
delete respHeaders['x-frame-options'];
|
package/src/up.cmd.js
CHANGED
|
@@ -44,6 +44,11 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
44
44
|
return this;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
withCookies(value) {
|
|
48
|
+
this._cookies = value;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
async doStop() {
|
|
48
53
|
await super.doStop();
|
|
49
54
|
if (this._watcher) {
|
|
@@ -76,7 +81,8 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
76
81
|
.withKill(this._kill)
|
|
77
82
|
.withPrintIndex(this._printIndex)
|
|
78
83
|
.withAllowInsecure(this._allowInsecure)
|
|
79
|
-
.withSiteToken(this._siteToken)
|
|
84
|
+
.withSiteToken(this._siteToken)
|
|
85
|
+
.withCookies(this._cookies);
|
|
80
86
|
|
|
81
87
|
this.log.info(chalk`{yellow ___ ________ ___ __ __ v${pkgJson.version}}`);
|
|
82
88
|
this.log.info(chalk`{yellow / | / ____/ |/ / _____(_)___ ___ __ __/ /___ _/ /_____ _____}`);
|
package/src/up.js
CHANGED
|
@@ -104,6 +104,11 @@ export default function up() {
|
|
|
104
104
|
type: 'boolean',
|
|
105
105
|
default: false,
|
|
106
106
|
})
|
|
107
|
+
.option('cookies', {
|
|
108
|
+
describe: 'Proxy all cookies in requests. By default, only the hlx-auth-token cookie is proxied.',
|
|
109
|
+
type: 'boolean',
|
|
110
|
+
default: false,
|
|
111
|
+
})
|
|
107
112
|
|
|
108
113
|
.help();
|
|
109
114
|
},
|
|
@@ -128,6 +133,7 @@ export default function up() {
|
|
|
128
133
|
.withAllowInsecure(argv.allowInsecure)
|
|
129
134
|
.withKill(argv.stopOther)
|
|
130
135
|
.withCache(argv.alphaCache)
|
|
136
|
+
.withCookies(argv.cookies)
|
|
131
137
|
.run();
|
|
132
138
|
},
|
|
133
139
|
};
|