mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-30 23:27:24 +00:00
Merge pull request #4398 from cg-zhou/feature/add-ip-ranges-env-var
Added IP_RANGES_FETCH_ENABLED environment variable
This commit is contained in:
@ -3,6 +3,8 @@
|
|||||||
const schema = require('./schema');
|
const schema = require('./schema');
|
||||||
const logger = require('./logger').global;
|
const logger = require('./logger').global;
|
||||||
|
|
||||||
|
const IP_RANGES_FETCH_ENABLED = process.env.IP_RANGES_FETCH_ENABLED !== 'false';
|
||||||
|
|
||||||
async function appStart () {
|
async function appStart () {
|
||||||
const migrate = require('./migrate');
|
const migrate = require('./migrate');
|
||||||
const setup = require('./setup');
|
const setup = require('./setup');
|
||||||
@ -13,7 +15,16 @@ async function appStart () {
|
|||||||
return migrate.latest()
|
return migrate.latest()
|
||||||
.then(setup)
|
.then(setup)
|
||||||
.then(schema.getCompiledSchema)
|
.then(schema.getCompiledSchema)
|
||||||
.then(internalIpRanges.fetch)
|
.then(() => {
|
||||||
|
if (IP_RANGES_FETCH_ENABLED) {
|
||||||
|
logger.info('IP Ranges fetch is enabled');
|
||||||
|
return internalIpRanges.fetch().catch((err) => {
|
||||||
|
logger.error('IP Ranges fetch failed, continuing anyway:', err.message);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
logger.info('IP Ranges fetch is disabled by environment variable');
|
||||||
|
}
|
||||||
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
internalCertificate.initTimer();
|
internalCertificate.initTimer();
|
||||||
internalIpRanges.initTimer();
|
internalIpRanges.initTimer();
|
||||||
|
@ -161,6 +161,14 @@ The easy fix is to add a Docker environment variable to the Nginx Proxy Manager
|
|||||||
DISABLE_IPV6: 'true'
|
DISABLE_IPV6: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Disabling IP Ranges Fetch
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
environment:
|
||||||
|
IP_RANGES_FETCH_ENABLED: 'false'
|
||||||
|
```
|
||||||
|
|
||||||
## Custom Nginx Configurations
|
## Custom Nginx Configurations
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user