Socket
Socket
Sign inDemoInstall

@growthbook/proxy

Package Overview
Dependencies
302
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.21 to 1.0.22

13

dist/middleware/cache/readThroughCacheMiddleware.js

@@ -56,14 +56,9 @@ "use strict";

if (!scopedMiddlewares[proxyTarget]) {
scopedMiddlewares[proxyTarget] = (0, http_proxy_middleware_1.createProxyMiddleware)({
target: proxyTarget,
changeOrigin: true,
selfHandleResponse: true,
onProxyRes: interceptor(proxyTarget),
onError: (err, req, res) => {
scopedMiddlewares[proxyTarget] = (0, http_proxy_middleware_1.createProxyMiddleware)(Object.assign({ target: proxyTarget, changeOrigin: true, selfHandleResponse: true, onProxyRes: interceptor(proxyTarget), onError: (err, req, res) => {
logger_1.default.error(err, "proxy error");
errorCounts[proxyTarget] = (errorCounts[proxyTarget] || 0) + 1;
res.status(500).json({ message: "Proxy error" });
},
logLevel: "silent",
});
}, logLevel: "silent", followRedirects: true }, (process.env.NODE_TLS_REJECT_UNAUTHORIZED === "0"
? { secure: false }
: {})));
}

@@ -70,0 +65,0 @@ return scopedMiddlewares[proxyTarget];

@@ -35,3 +35,6 @@ "use strict";

const entry = yield got_1.default
.get(url, { headers: { "User-Agent": `GrowthBook Proxy` } })
.get(url, {
headers: { "User-Agent": `GrowthBook Proxy` },
rejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== "0",
})
.json()

@@ -38,0 +41,0 @@ .catch((e) => logger_1.default.error(e, "Refresh stale cache error"))

@@ -11,6 +11,5 @@ "use strict";

if (!scopedMiddlewares[registrar_1.registrar.growthbookApiHost]) {
scopedMiddlewares[registrar_1.registrar.growthbookApiHost] = (0, http_proxy_middleware_1.createProxyMiddleware)({
target: registrar_1.registrar.growthbookApiHost,
changeOrigin: true,
});
scopedMiddlewares[registrar_1.registrar.growthbookApiHost] = (0, http_proxy_middleware_1.createProxyMiddleware)(Object.assign({ target: registrar_1.registrar.growthbookApiHost, changeOrigin: true, followRedirects: true }, (process.env.NODE_TLS_REJECT_UNAUTHORIZED === "0"
? { secure: false }
: {})));
}

@@ -17,0 +16,0 @@ return scopedMiddlewares[registrar_1.registrar.growthbookApiHost](req, res, next);

@@ -91,3 +91,6 @@ "use strict";

const resp = (yield got_1.default
.get(url, { headers })
.get(url, {
headers,
rejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== "0",
})
.json()

@@ -94,0 +97,0 @@ .catch((e) => logger_1.default.error(e, "polling error")));

@@ -7,3 +7,3 @@ {

"description": "GrowthBook proxy server for caching, realtime updates, telemetry, etc",
"version": "1.0.21",
"version": "1.0.22",
"main": "dist/app.js",

@@ -10,0 +10,0 @@ "license": "MIT",

@@ -8,2 +8,3 @@ # GrowthBook Proxy

### Features:
- :zap: **Caching** - Significantly faster feature lookups!

@@ -38,3 +39,5 @@ - In-memory cache plus an optional distributed layer (Redis or MongoDB)

### Self-hosted customers
You will also need to ensure that your self-hosted GrowthBook instance is configured to use the proxy server. This includes setting environment variables:
```

@@ -47,8 +50,9 @@ PROXY_ENABLED=1

```
See GrowthBook's [Proxy documentation](https://docs.growthbook.io/self-host/proxy#standalone) for more information.
### Cloud customers
For GrowthBook Cloud customers, use the GrowthBook app UI to create an API key in **Settings -> API Keys**. Additionally, you will need to set proxy's `GROWTHBOOK_API_HOST` environment variable to the cloud API server: `https://api.growthbook.io`.
## Configuration

@@ -63,2 +67,3 @@

### Caching
By default, features are cached in memory in GrowthBook Proxy; you may provide your own cache service via Redis or Mongo. To fully utilize the GrowthBook Proxy, we highly recommend using Redis, which is a prerequisite for real-time updates when your proxy is horizontally scaled (as proxy instances are kept in-sync using Redis pub/sub).

@@ -72,4 +77,6 @@

#### Redis Cluster
Redis-specific options for cluster mode:<br />
_(Note that CACHE_CONNECTION_URL is ignored when using cluster mode)_
- `USE_CLUSTER` - "true" or "1" to enable

@@ -81,2 +88,3 @@ - `CLUSTER_ROOT_NODES` - simple: comma-separated URLs to your cluster seed nodes

#### MongoDB
Mongo-specific options:

@@ -87,3 +95,2 @@

### Horizontally scaling

@@ -95,3 +102,2 @@

### SSL termination & HTTP2

@@ -105,2 +111,4 @@

If the GrowthBook app your proxy is connecting to is using a self-signed certificate, you can disable certificate verification by setting `NODE_TLS_REJECT_UNAUTHORIZED` to "0".
### Other common configuration options

@@ -112,2 +120,2 @@

- `EVENT_STREAM_MAX_DURATION_MS` - The maximum duration of a SSE connection before the client is forced to reconnect (default is `60000` = 1 minute)
- `EVENT_STREAM_PING_INTERVAL_MS` - The interval between SSE "ping" messages sent to the client (default is `30000` = 30 seconds)
- `EVENT_STREAM_PING_INTERVAL_MS` - The interval between SSE "ping" messages sent to the client (default is `30000` = 30 seconds)

@@ -81,2 +81,6 @@ import { IncomingMessage, ServerResponse } from "http";

logLevel: "silent",
followRedirects: true,
...(process.env.NODE_TLS_REJECT_UNAUTHORIZED === "0"
? { secure: false }
: {}),
});

@@ -83,0 +87,0 @@ }

@@ -27,3 +27,6 @@ import got from "got";

const entry = await got
.get(url, { headers: { "User-Agent": `GrowthBook Proxy` } })
.get(url, {
headers: { "User-Agent": `GrowthBook Proxy` },
rejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== "0",
})
.json()

@@ -30,0 +33,0 @@ .catch((e) => logger.error(e, "Refresh stale cache error"))

@@ -15,2 +15,6 @@ import { NextFunction, Request, Response } from "express";

changeOrigin: true,
followRedirects: true,
...(process.env.NODE_TLS_REJECT_UNAUTHORIZED === "0"
? { secure: false }
: {}),
});

@@ -17,0 +21,0 @@ }

@@ -101,3 +101,6 @@ import got from "got";

const resp = (await got
.get(url, { headers })
.get(url, {
headers,
rejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== "0",
})
.json()

@@ -104,0 +107,0 @@ .catch((e) => logger.error(e, "polling error"))) as

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc