NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
23.43k stars 2.72k forks source link

Fetching IP Ranges Timeout #3157

Open theflu opened 1 year ago

theflu commented 1 year ago

Checklist

Describe the bug Long startup time due to waiting for "Fetching IP Ranges" to timeout.

nginx-proxy-manager | [8/24/2023] [7:04:29 PM] [IP Ranges] › ℹ  info      Fetching IP Ranges from online services...
nginx-proxy-manager | [8/24/2023] [7:04:29 PM] [IP Ranges] › ℹ  info      Fetching https://ip-ranges.amazonaws.com/ip-ranges.json
nginx-proxy-manager | [8/24/2023] [7:06:39 PM] [IP Ranges] › ✖  error     connect ETIMEDOUT 99.84.208.32:443

Nginx Proxy Manager Version v2.10.4

To Reproduce Steps to reproduce the behavior:

  1. Require your docker server to use http proxy for internet access
  2. Add proxy env var to compose file IE "HTTP_PROXY=proxy.example.com:3128" "HTTPS_PROXY=proxy.example.com:3128"
  3. Start container
  4. See logs

Expected behavior Use the http proxy in the environment variables or a way to specify the ip range in the compose file

Operating System Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-79-generic x86_64)

NeDolM commented 8 months ago

This issue even happens right out the box

Fetching https://ip-ranges.amazonaws.com/ip-ranges.json resulting in failure is still an issue IN 2024!!!

NovaShen555 commented 2 months ago

and it still not be solved......

rer-coder commented 2 months ago

Yes, it is still a problem in tencent cloud.

rer-coder commented 2 months ago

I can get the https://ip-ranges.amazonaws.com/ip-ranges.json information with the curl command in the Docker container, but in NPM, I use the fetch command of node to execute the statement:

const fetch = require('node-fetch');
fetch('https://ip-ranges.amazonaws.com/ip-ranges.json').then(response => response.text()).then(data => console.log(data)).catch(error => console.error('Error fetching data:', error));

The return value is:

> Error fetching data: FetchError: Invalid response body while trying to fetch https://ip-ranges.amazonaws.com/ip-ranges.json: read ECONNRESET
    at PassThrough.<anonymous> (/app/node_modules/node-fetch/lib/index.js:400:12)
    at PassThrough.emit (node:events:531:35)
    at PassThrough.emit (node:domain:488:12)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNRESET',
  code: 'ECONNRESET'
jqknono commented 2 months ago

The Fetching https://ip-ranges.amazonaws.com/ip-ranges.json blocked at startup. Sometimes this will cost a lot of time.

If you're blocked by this fetching too, just run:

NPM_CTR_NAME=nginxproxymanager
docker exec $NPM_CTR_NAME sed -i 's/\.then(internalIpRanges\.fetch)//g' /app/index.js
docker restart $NPM_CTR_NAME

This should skip the fetching at the startup.

Here's the code change solution https://github.com/NginxProxyManager/nginx-proxy-manager/commit/326380cc563fe6d2dc3bd9e8cb25c6cf88ec400e

Not merged to the repo since I haven't tested it.