Strapi fails to start on using HOST env variable

I have deployed strapi using docker in a domain (say abcd@efgh.com). I’ve not added the environment variables HOST & PORT to it.

Everything else seems to work fine, but when I use google to sign in users to strapi, the developer info for google sign contains the redirection link as localhost:1337(http).

I wanted it to redirect to the domain mentioned above. So on adding the HOST as “abcd@efgh.com” and PORT as 7777 (the port number used for deploying it, also mentioned in the docker-compose file), the strapi fails to start when I run the docker-compose.

This is the error
“error Error: listen EADDRNOTAVAIL: address not available [host-ip]:7777”.

Having the default value of “0.0.0.0” for the HOST works, but doesn’t redirect to the domain mentioned, when using google sign in.

Node: v12.18.0
npm: 6.14.4
strapi: 3.0.0-beta.19.5

Any help would be appreciated. Thanks.

Hello @rithuacharya

The HOST environment variable is what is used to bind the node.js http server to, hence why it most likely won’t work for you. We specifically have a configuration to handle the “public address” that is used throughout the entire application. You can find the docs for it here: https://strapi.io/documentation/v3.x/concepts/configurations.html#server

But effectively you need to set the url key to whatever your public domain is.

@rithuacharya I am having the same issue on my qovery deployd app. callback redirection to http://0.0.0.0:1337/auth/google/callback instead of my domain.

send a working link. this one is a 404 not found.

@mdmundo
Please use the url parameter in server.js file. Redirection will happen based on that value