@cloud-cli/px 3.5.0 → 3.5.2

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.
@@ -29,10 +29,11 @@ export class ProxyManager {
29
29
  });
30
30
  }
31
31
  async updateProxy(options) {
32
- const query = new Query().where('domain').is(options.domain || options.host);
32
+ const domain = options.domain || options.host;
33
+ const query = new Query().where('domain').is(domain);
33
34
  const proxies = await Resource.find(ProxyEntry, query);
34
35
  if (!proxies.length) {
35
- return false;
36
+ proxies.push(new ProxyEntry({ domain }));
36
37
  }
37
38
  for (const proxy of proxies) {
38
39
  ['target', 'cors', 'redirect', 'redirectUrl'].forEach(p => p in options && (proxy[p] = options[p]));
package/dist/proxy.js CHANGED
@@ -179,7 +179,7 @@ export class ProxyServer {
179
179
  }
180
180
  handleError(error, res) {
181
181
  console.error(error);
182
- if (error.code === 'ECONNREFUSED') {
182
+ if (error.code === 'ECONNREFUSED' || error.code === 'ECONNRESET') {
183
183
  res.writeHead(502);
184
184
  res.end();
185
185
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-cli/px",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "Reverse Proxy",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",