@gasket/plugin-https-proxy 7.1.4 → 7.2.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.
Files changed (2) hide show
  1. package/README.md +37 -1
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -56,6 +56,41 @@ The `protocol` and `hostname` are only used for logging about the proxy server
56
56
  and should not be confused with `target.protocol` and `target.host` which
57
57
  are used for the actual destination server.
58
58
 
59
+ ### Example SNI Config
60
+
61
+ While not specifically called out in the [http-proxy] documentation, the
62
+ `ssl` settings are what get passed to node's `createServer` method.
63
+ As such, you can use `SNICallback` from the [createServer options].
64
+
65
+ ```diff
66
+ // gasket.js
67
+ export default makeGasket({
68
+ httpsProxy: {
69
+ protocol: 'https',
70
+ hostname: 'my-host.com',
71
+ port: 443,
72
+ xfwd: true,
73
+ ws: true,
74
+ target: {
75
+ host: 'localhost',
76
+ port: 80
77
+ },
78
+ + ssl: {
79
+ + SNICallback: (hostname, cb) => {
80
+ + const ctx = tls.createSecureContext({
81
+ + key: fs.readFileSync(`./certs/${hostname}.key`),
82
+ + cert: fs.readFileSync(`./certs/${hostname}.crt`)
83
+ + });
84
+ + cb(null, ctx);
85
+ }
86
+ }
87
+ }
88
+ });
89
+ ```
90
+
91
+ > The above snippet is for demonstration purposes only.
92
+ > You should not be reading your certs from the filesystem for each request.
93
+
59
94
  ## Actions
60
95
 
61
96
  ### startProxyServer
@@ -82,7 +117,7 @@ export default {
82
117
  hooks: {
83
118
  httpsProxy: async function (gasket, httpsProxyConfig) {
84
119
  return {
85
- ...devProxyConfig,
120
+ ...httpsProxyConfig,
86
121
  hostname: 'local.example.com',
87
122
  port: 8443
88
123
  }
@@ -97,3 +132,4 @@ export default {
97
132
 
98
133
  [http-proxy]: https://www.npmjs.com/package/http-proxy
99
134
  [options]: https://www.npmjs.com/package/http-proxy#options
135
+ [createServer options]: https://nodejs.org/docs/latest-v22.x/api/tls.html#tlscreateserveroptions-secureconnectionlistener
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasket/plugin-https-proxy",
3
- "version": "7.1.4",
3
+ "version": "7.2.1",
4
4
  "description": "Adds support for running an https proxy",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -41,8 +41,8 @@
41
41
  "http-proxy": "^1.18.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@gasket/core": "^7.1.4",
45
- "@gasket/plugin-logger": "^7.1.4",
44
+ "@gasket/core": "^7.2.1",
45
+ "@gasket/plugin-logger": "^7.2.1",
46
46
  "@types/node": "^20.12.5",
47
47
  "eslint": "^8.56.0",
48
48
  "eslint-config-godaddy": "^7.1.1",
@@ -66,5 +66,5 @@
66
66
  "unicorn/filename-case": "error"
67
67
  }
68
68
  },
69
- "gitHead": "7d77c8fbff84ea9ae18b0f6b265f25bbbc25135e"
69
+ "gitHead": "8af41663d838cb00344ffbdabf64fc535b78dd3d"
70
70
  }