[GH-ISSUE #8475] [Bug] connect() failed (111: Connection refused) while connecting to upstream #3870

Closed
opened 2026-03-23 21:33:45 +00:00 by mirror · 0 comments
Owner

Originally created by @guilhermeelkadri on GitHub (Feb 8, 2026).
Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/8475

Bug Description

Hello all,

Currently, I am setting up my raspberry pi for self hosting appFlowy cloud.

But I am facing issue creating an user in the console admin, and further the client login.

What happens

  • Creating a user from Admin Console fails with 502.
  • Nginx shows:
    • upstream prematurely closed connection while reading response header from upstream (on POST /api/admin/users)
    • right after: connect() failed (111: Connection refused) (on GET /api/admin/license/usage)

Looks like the backend accepts the connection, then dies/restarts mid-request, and isn’t listening for the next call.

How to Reproduce

Open: http://[my-host]:7380/console/users-management
Click to create a user.
See 502 (Bad gateway):

Image

docker appflowy nginx container log, during the error:

$ docker logs appflowy-cloud-nginx-1 -f
2026/02/08 09:37:22 [error] 29#29: *23 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.35, server: , request: "POST /api/admin/users HTTP/1.1", upstream: "http://172.18.0.7:8000/api/admin/users", host: "192.168.1.25:7380", referrer: "http://192.168.1.25:7380/console/users-management"
192.168.1.35 - - [08/Feb/2026:09:37:22 +0000] "POST /api/admin/users HTTP/1.1" 502 559 "http://192.168.1.25:7380/console/users-management" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"
2026/02/08 09:37:22 [error] 29#29: *23 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.35, server: , request: "GET /api/admin/license/usage HTTP/1.1", upstream: "http://172.18.0.7:8000/api/admin/license/usage", host: "192.168.1.25:7380", referrer: "http://192.168.1.25:7380/console/users-management"
192.168.1.35 - - [08/Feb/2026:09:37:22 +0000] "GET /api/admin/license/usage HTTP/1.1" 502 559 "http://192.168.1.25:7380/console/users-management" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"

test access from nginx container:

$ docker exec -it appflowy-cloud-nginx-1 /bin/sh
# apk add --no-cache curl 2>/dev/null || true
# curl -sv http://gotrue:9999/health || curl -sv http://gotrue:9999/
* Host gotrue:9999 was resolved.
* IPv6: (none)
* IPv4: 172.18.0.6
*   Trying 172.18.0.6:9999...
* Connected to gotrue (172.18.0.6) port 9999
* using HTTP/1.x
> GET /health HTTP/1.1
> Host: gotrue:9999
> User-Agent: curl/8.14.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
< Content-Type: application/json
< Vary: Origin
< Date: Sun, 08 Feb 2026 09:10:16 GMT
< Content-Length: 99
< 
* Connection #0 to host gotrue left intact
{"version":"","name":"GoTrue","description":"GoTrue is a user registration and authentication API"}# 
# curl -sv http://minio:9000/minio/health/ready || true
* Host minio:9000 was resolved.
* IPv6: (none)
* IPv4: 172.18.0.4
*   Trying 172.18.0.4:9000...
* Connected to minio (172.18.0.4) port 9000
* using HTTP/1.x
> GET /minio/health/ready HTTP/1.1
> Host: minio:9000
> User-Agent: curl/8.14.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Length: 0
< Server: MinIO
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< Vary: Origin
< X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
< X-Amz-Request-Id: 18923A6BA20A2129
< X-Content-Type-Options: nosniff
< X-Xss-Protection: 1; mode=block
< Date: Sun, 08 Feb 2026 09:10:37 GMT
< 
* Connection #0 to host minio left intact
# curl -sv http://appflowy_cloud:8000/health || curl -sv http://appflowy_cloud:8000/
* Host appflowy_cloud:8000 was resolved.
* IPv6: (none)
* IPv4: 172.18.0.7
*   Trying 172.18.0.7:8000...
* Connected to appflowy_cloud (172.18.0.7) port 8000
* using HTTP/1.x
> GET /health HTTP/1.1
> Host: appflowy_cloud:8000
> User-Agent: curl/8.14.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 404 Not Found
< content-length: 0
< x-request-id: 3ba8854f-2d04-45e9-a2c9-20bc58ef12ad
< vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers
< access-control-expose-headers: cache-control, content-type
< access-control-allow-credentials: true
< date: Sun, 08 Feb 2026 09:10:52 GMT
< 
* Connection #0 to host appflowy_cloud left intact
# 

Client login faces issues as well:

Image

Changes done in the deploy.env file:

...
# Fully qualified domain name for the deployment. Replace localhost with your domain,
# such as mydomain.com.
FQDN=192.168.1.25:7380
...
# NGINX Configuration
# Optional, change this if you want to use custom ports to expose AppFlowy
NGINX_PORT=7380
NGINX_TLS_PORT=7343

docker container running with no failure:

$ docker compose ps
WARN[0000] The "APPFLOWY_S3_REGION" variable is not set. Defaulting to a blank string. 
WARN[0000] The "AZURE_OPENAI_API_KEY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "AZURE_OPENAI_ENDPOINT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "AZURE_OPENAI_API_VERSION" variable is not set. Defaulting to a blank string. 
WARN[0000] The "APPFLOWY_S3_REGION" variable is not set. Defaulting to a blank string. 
WARN[0000] The "APPFLOWY_S3_REGION" variable is not set. Defaulting to a blank string. 
NAME                               IMAGE                                COMMAND                  SERVICE           CREATED          STATUS                     PORTS
appflowy-cloud-admin_frontend-1    appflowyinc/admin_frontend:latest    "/docker-entrypoint.…"   admin_frontend    10 minutes ago   Up 9 minutes               3000/tcp
appflowy-cloud-ai-1                appflowyinc/appflowy_ai:latest       "appflowy-ai"            ai                10 minutes ago   Up 9 minutes (unhealthy)   5001/tcp
appflowy-cloud-appflowy_cloud-1    appflowyinc/appflowy_cloud:latest    "appflowy_cloud"         appflowy_cloud    10 minutes ago   Up 7 minutes (healthy)     8000/tcp
appflowy-cloud-appflowy_web-1      appflowyinc/appflowy_web:latest      "/docker-entrypoint.…"   appflowy_web      10 minutes ago   Up 9 minutes               80/tcp
appflowy-cloud-appflowy_worker-1   appflowyinc/appflowy_worker:latest   "appflowy_worker"        appflowy_worker   51 minutes ago   Up 47 seconds              
appflowy-cloud-gotrue-1            appflowyinc/gotrue:latest            "./start.sh"             gotrue            10 minutes ago   Up 10 minutes (healthy)    
appflowy-cloud-minio-1             minio/minio                          "/usr/bin/docker-ent…"   minio             10 minutes ago   Up 10 minutes (healthy)    9000/tcp
appflowy-cloud-nginx-1             nginx                                "/docker-entrypoint.…"   nginx             10 minutes ago   Up 10 minutes              0.0.0.0:7380->80/tcp, [::]:7380->80/tcp, 0.0.0.0:7343->443/tcp, [::]:7343->443/tcp
appflowy-cloud-postgres-1          pgvector/pgvector:pg16               "docker-entrypoint.s…"   postgres          51 minutes ago   Up 51 minutes (healthy)    5432/tcp
appflowy-cloud-redis-1             redis                                "docker-entrypoint.s…"   redis             51 minutes ago   Up 51 minutes              6379/tcp

Raspberry pi:

$ uname -a
Linux xyz 5.15.0-1093-raspi #96-Ubuntu SMP PREEMPT Tue Jan 20 18:38:19 UTC 2026 aarch64 aarch64 aarch64 GNU/Linux

Expected Behavior

Expected result, got from am different appFLowy server created in a sandbox:

192.168.122.239 - - [07/Feb/2026:13:27:51 +0000] "OPTIONS /api/admin/users HTTP/1.1" 200 0 "http://localhost:7380/" "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0"
192.168.122.239 - - [07/Feb/2026:13:27:51 +0000] "POST /api/admin/users HTTP/1.1" 200 1093 "http://localhost:7380/" "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0"
192.168.122.239 - - [07/Feb/2026:13:27:51 +0000] "GET /api/admin/users?page=1&limit=20 HTTP/1.1" 200 1483 "http://localhost:7380/" "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0"
192.168.122.239 - - [07/Feb/2026:13:27:51 +0000] "GET /api/admin/license/usage HTTP/1.1" 200 97 "http://localhost:7380/" "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0"

Operating System

Linux xyz 5.15.0-1093-raspi #96-Ubuntu SMP PREEMPT Tue Jan 20 18:38:19 UTC 2026 aarch64 aarch64 aarch64 GNU/Linux

AppFlowy Version(s)

707873f6 (HEAD -> main, origin/main, origin/HEAD) chore: update nginx

Screenshots

No response

Additional Context

No response

Originally created by @guilhermeelkadri on GitHub (Feb 8, 2026). Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/8475 ### Bug Description Hello all, Currently, I am setting up my raspberry pi for self hosting appFlowy cloud. But I am facing issue creating an user in the console admin, and further the client login. ### What happens - Creating a user from **Admin Console** fails with **502**. - Nginx shows: - `upstream prematurely closed connection while reading response header from upstream` (on `POST /api/admin/users`) - right after: `connect() failed (111: Connection refused)` (on `GET /api/admin/license/usage`) **Looks like** the backend accepts the connection, then dies/restarts mid-request, and isn’t listening for the next call. ### How to Reproduce Open: http://[my-host]:7380/console/users-management Click to create a user. See 502 (Bad gateway): <img width="1257" height="1006" alt="Image" src="https://github.com/user-attachments/assets/2f5ba42c-a67d-4390-bfa5-43a3c11c4673" /> docker appflowy nginx container log, during the error: ```jsx $ docker logs appflowy-cloud-nginx-1 -f 2026/02/08 09:37:22 [error] 29#29: *23 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.35, server: , request: "POST /api/admin/users HTTP/1.1", upstream: "http://172.18.0.7:8000/api/admin/users", host: "192.168.1.25:7380", referrer: "http://192.168.1.25:7380/console/users-management" 192.168.1.35 - - [08/Feb/2026:09:37:22 +0000] "POST /api/admin/users HTTP/1.1" 502 559 "http://192.168.1.25:7380/console/users-management" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36" 2026/02/08 09:37:22 [error] 29#29: *23 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.35, server: , request: "GET /api/admin/license/usage HTTP/1.1", upstream: "http://172.18.0.7:8000/api/admin/license/usage", host: "192.168.1.25:7380", referrer: "http://192.168.1.25:7380/console/users-management" 192.168.1.35 - - [08/Feb/2026:09:37:22 +0000] "GET /api/admin/license/usage HTTP/1.1" 502 559 "http://192.168.1.25:7380/console/users-management" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36" ``` test access from nginx container: ```jsx $ docker exec -it appflowy-cloud-nginx-1 /bin/sh # apk add --no-cache curl 2>/dev/null || true # curl -sv http://gotrue:9999/health || curl -sv http://gotrue:9999/ * Host gotrue:9999 was resolved. * IPv6: (none) * IPv4: 172.18.0.6 * Trying 172.18.0.6:9999... * Connected to gotrue (172.18.0.6) port 9999 * using HTTP/1.x > GET /health HTTP/1.1 > Host: gotrue:9999 > User-Agent: curl/8.14.1 > Accept: */* > * Request completely sent off < HTTP/1.1 200 OK < Content-Type: application/json < Vary: Origin < Date: Sun, 08 Feb 2026 09:10:16 GMT < Content-Length: 99 < * Connection #0 to host gotrue left intact {"version":"","name":"GoTrue","description":"GoTrue is a user registration and authentication API"}# # curl -sv http://minio:9000/minio/health/ready || true * Host minio:9000 was resolved. * IPv6: (none) * IPv4: 172.18.0.4 * Trying 172.18.0.4:9000... * Connected to minio (172.18.0.4) port 9000 * using HTTP/1.x > GET /minio/health/ready HTTP/1.1 > Host: minio:9000 > User-Agent: curl/8.14.1 > Accept: */* > * Request completely sent off < HTTP/1.1 200 OK < Accept-Ranges: bytes < Content-Length: 0 < Server: MinIO < Strict-Transport-Security: max-age=31536000; includeSubDomains < Vary: Origin < X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8 < X-Amz-Request-Id: 18923A6BA20A2129 < X-Content-Type-Options: nosniff < X-Xss-Protection: 1; mode=block < Date: Sun, 08 Feb 2026 09:10:37 GMT < * Connection #0 to host minio left intact # curl -sv http://appflowy_cloud:8000/health || curl -sv http://appflowy_cloud:8000/ * Host appflowy_cloud:8000 was resolved. * IPv6: (none) * IPv4: 172.18.0.7 * Trying 172.18.0.7:8000... * Connected to appflowy_cloud (172.18.0.7) port 8000 * using HTTP/1.x > GET /health HTTP/1.1 > Host: appflowy_cloud:8000 > User-Agent: curl/8.14.1 > Accept: */* > * Request completely sent off < HTTP/1.1 404 Not Found < content-length: 0 < x-request-id: 3ba8854f-2d04-45e9-a2c9-20bc58ef12ad < vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers < access-control-expose-headers: cache-control, content-type < access-control-allow-credentials: true < date: Sun, 08 Feb 2026 09:10:52 GMT < * Connection #0 to host appflowy_cloud left intact # ``` Client login faces issues as well: <img width="1276" height="996" alt="Image" src="https://github.com/user-attachments/assets/09107490-5562-4b46-b822-cf7c9ede729f" /> Changes done in the deploy.env file: ```jsx ... # Fully qualified domain name for the deployment. Replace localhost with your domain, # such as mydomain.com. FQDN=192.168.1.25:7380 ... # NGINX Configuration # Optional, change this if you want to use custom ports to expose AppFlowy NGINX_PORT=7380 NGINX_TLS_PORT=7343 ``` docker container running with no failure: ```jsx $ docker compose ps WARN[0000] The "APPFLOWY_S3_REGION" variable is not set. Defaulting to a blank string. WARN[0000] The "AZURE_OPENAI_API_KEY" variable is not set. Defaulting to a blank string. WARN[0000] The "AZURE_OPENAI_ENDPOINT" variable is not set. Defaulting to a blank string. WARN[0000] The "AZURE_OPENAI_API_VERSION" variable is not set. Defaulting to a blank string. WARN[0000] The "APPFLOWY_S3_REGION" variable is not set. Defaulting to a blank string. WARN[0000] The "APPFLOWY_S3_REGION" variable is not set. Defaulting to a blank string. NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS appflowy-cloud-admin_frontend-1 appflowyinc/admin_frontend:latest "/docker-entrypoint.…" admin_frontend 10 minutes ago Up 9 minutes 3000/tcp appflowy-cloud-ai-1 appflowyinc/appflowy_ai:latest "appflowy-ai" ai 10 minutes ago Up 9 minutes (unhealthy) 5001/tcp appflowy-cloud-appflowy_cloud-1 appflowyinc/appflowy_cloud:latest "appflowy_cloud" appflowy_cloud 10 minutes ago Up 7 minutes (healthy) 8000/tcp appflowy-cloud-appflowy_web-1 appflowyinc/appflowy_web:latest "/docker-entrypoint.…" appflowy_web 10 minutes ago Up 9 minutes 80/tcp appflowy-cloud-appflowy_worker-1 appflowyinc/appflowy_worker:latest "appflowy_worker" appflowy_worker 51 minutes ago Up 47 seconds appflowy-cloud-gotrue-1 appflowyinc/gotrue:latest "./start.sh" gotrue 10 minutes ago Up 10 minutes (healthy) appflowy-cloud-minio-1 minio/minio "/usr/bin/docker-ent…" minio 10 minutes ago Up 10 minutes (healthy) 9000/tcp appflowy-cloud-nginx-1 nginx "/docker-entrypoint.…" nginx 10 minutes ago Up 10 minutes 0.0.0.0:7380->80/tcp, [::]:7380->80/tcp, 0.0.0.0:7343->443/tcp, [::]:7343->443/tcp appflowy-cloud-postgres-1 pgvector/pgvector:pg16 "docker-entrypoint.s…" postgres 51 minutes ago Up 51 minutes (healthy) 5432/tcp appflowy-cloud-redis-1 redis "docker-entrypoint.s…" redis 51 minutes ago Up 51 minutes 6379/tcp ``` Raspberry pi: ```jsx $ uname -a Linux xyz 5.15.0-1093-raspi #96-Ubuntu SMP PREEMPT Tue Jan 20 18:38:19 UTC 2026 aarch64 aarch64 aarch64 GNU/Linux ``` ### Expected Behavior Expected result, got from am different appFLowy server created in a sandbox: ```jsx 192.168.122.239 - - [07/Feb/2026:13:27:51 +0000] "OPTIONS /api/admin/users HTTP/1.1" 200 0 "http://localhost:7380/" "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0" 192.168.122.239 - - [07/Feb/2026:13:27:51 +0000] "POST /api/admin/users HTTP/1.1" 200 1093 "http://localhost:7380/" "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0" 192.168.122.239 - - [07/Feb/2026:13:27:51 +0000] "GET /api/admin/users?page=1&limit=20 HTTP/1.1" 200 1483 "http://localhost:7380/" "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0" 192.168.122.239 - - [07/Feb/2026:13:27:51 +0000] "GET /api/admin/license/usage HTTP/1.1" 200 97 "http://localhost:7380/" "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0" ``` ### Operating System Linux xyz 5.15.0-1093-raspi #96-Ubuntu SMP PREEMPT Tue Jan 20 18:38:19 UTC 2026 aarch64 aarch64 aarch64 GNU/Linux ### AppFlowy Version(s) 707873f6 (HEAD -> main, origin/main, origin/HEAD) chore: update nginx ### Screenshots _No response_ ### Additional Context _No response_
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#3870
No description provided.