@adobe/helix-deploy 10.0.1 → 10.1.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [10.1.0](https://github.com/adobe/helix-deploy/compare/v10.0.1...v10.1.0) (2024-01-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * add support for custom headers ([#640](https://github.com/adobe/helix-deploy/issues/640)) ([a726f7a](https://github.com/adobe/helix-deploy/commit/a726f7a994b9e6c764a107c7f5dde8975adda48f))
7
+
1
8
  ## [10.0.1](https://github.com/adobe/helix-deploy/compare/v10.0.0...v10.0.1) (2024-01-13)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "10.0.1",
3
+ "version": "10.1.0",
4
4
  "description": "Library and Commandline Tools to build and deploy OpenWhisk Actions",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/adobe/helix-deploy#readme",
@@ -71,7 +71,7 @@ export default class DevelopmentServer {
71
71
  this._main = main;
72
72
  this._cwd = process.cwd();
73
73
  this._port = process.env.WEBSERVER_PORT || 3000;
74
- this._xfh = 'helix-pages.anywhere.run';
74
+ this._headers = {};
75
75
  }
76
76
 
77
77
  withPort(value) {
@@ -80,7 +80,13 @@ export default class DevelopmentServer {
80
80
  }
81
81
 
82
82
  withXFH(value) {
83
- this._xfh = value;
83
+ process.emitWarning('DevelopmentServer.withXFH is deprecated. Use withHeader(\'x-forwarded-host\') instead.', 'DeprecationWarning');
84
+ this._headers['x-forwarded-host'] = value;
85
+ return this;
86
+ }
87
+
88
+ withHeader(name, value) {
89
+ this._headers[name] = value;
84
90
  return this;
85
91
  }
86
92
 
@@ -206,9 +212,9 @@ export default class DevelopmentServer {
206
212
  }
207
213
  });
208
214
  this.app.use(rawBody());
209
- if (this._xfh) {
210
- this.app.use(addRequestHeader('x-forwarded-host', this._xfh.replace('{port}', this._port)));
211
- }
215
+ Object.entries(this._headers).forEach(([name, value]) => {
216
+ this.app.use(addRequestHeader(name, value.replace('{port}', this._port)));
217
+ });
212
218
  this.app.all('*', this._handler);
213
219
  }
214
220