System Information
- 4.14.6:
- Alpine Linux / Docker Container:
- MySQL 8:
- Node v20.10.0:
- NPM 10.x:
I have a Strapi instance on a docker container behind a reverse proxy.
Locally from the container, Strapi is reachable, from outside the container I get “connection refused” errors.
Interesting fact is that Strapi is telling me at startup that it listens on 127.0.0.1, which would explain why strapi refuses external requests.
┌─────────────────────────────┐
│ http://127.0.0.1:1337/admin │
└─────────────────────────────┘
config/server.js
tells me that the default is 0.0.0.0
and HOST
is not set.
export default ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
app: {
keys: env.array('APP_KEYS'),
},
webhooks: {
populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
},
});
I guess that setting host
directly in config/server.js
would not change anything.
I have a number of containers that run various services, and a reverse proxy that distributes the requests. I also run other strapi instances that work. The environment is the same for all and this specific instance behaves the way i described. The only thing that puzzles me is that it tells me that it listens on 127.0.0.1:1337 which indicates that it only listes on requests to 127.0.0.1. The working Strapi instances listen on 0.0.0.0:1337.