Skip to content

Commit d98f4b4

Browse files
authored
Merge pull request #4398 from cg-zhou/feature/add-ip-ranges-env-var
Added IP_RANGES_FETCH_ENABLED environment variable
2 parents ff3116a + 0792fc0 commit d98f4b4

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

backend/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
const schema = require('./schema');
44
const logger = require('./logger').global;
55

6+
const IP_RANGES_FETCH_ENABLED = process.env.IP_RANGES_FETCH_ENABLED !== 'false';
7+
68
async function appStart () {
79
const migrate = require('./migrate');
810
const setup = require('./setup');
@@ -13,7 +15,16 @@ async function appStart () {
1315
return migrate.latest()
1416
.then(setup)
1517
.then(schema.getCompiledSchema)
16-
.then(internalIpRanges.fetch)
18+
.then(() => {
19+
if (IP_RANGES_FETCH_ENABLED) {
20+
logger.info('IP Ranges fetch is enabled');
21+
return internalIpRanges.fetch().catch((err) => {
22+
logger.error('IP Ranges fetch failed, continuing anyway:', err.message);
23+
});
24+
} else {
25+
logger.info('IP Ranges fetch is disabled by environment variable');
26+
}
27+
})
1728
.then(() => {
1829
internalCertificate.initTimer();
1930
internalIpRanges.initTimer();

docs/src/advanced-config/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ The easy fix is to add a Docker environment variable to the Nginx Proxy Manager
161161
DISABLE_IPV6: 'true'
162162
```
163163

164+
## Disabling IP Ranges Fetch
165+
166+
By default, NPM fetches IP ranges from CloudFront and Cloudflare during application startup. In environments with limited internet access or to speed up container startup, this fetch can be disabled:
167+
168+
```yml
169+
environment:
170+
IP_RANGES_FETCH_ENABLED: 'false'
171+
```
164172

165173
## Custom Nginx Configurations
166174

0 commit comments

Comments
 (0)