Cómo permitir hosts personalizados en modo desarrollo

Hi.

I’m new to discourse and started diving into it by setting up a development system, following this howto.
Afterwards I was able to access my instance via ip address, but trying to access via hostname fails with following message:

Blocked host: discourse_example_net
To allow requests to discourse_example_net, add the following to your environment configuration:
config.hosts << “discourse_example_net”

I found this PR, but I don’t know how to set the env var.

Best,
Luis

2 Me gusta

You can prepend DISCOURSE_DEV_HOSTS=discourse_example_net to the command that starts the unicorn server, or you can set the variable in your ~/.bashrc (or the rc file of the shell you use).

5 Me gusta

Lo intenté con DISCOURSE_DEV_HOSTS=xxx.ngrok.io d/unicorn y, lamentablemente, no funcionó.

Asumo que cuando dices “no funcionó”, te refieres a que sigues obteniendo el mismo error que el OP. Parece que estás usando Docker para el desarrollo, por lo que necesitas establecer esta variable de entorno dentro del contenedor, no en la máquina anfitriona. Yo no uso Docker para el desarrollo, pero parece que d/boot_dev puede establecer variables dentro del contenedor por ti:

d/boot_dev -e DISCOURSE_DEV_HOSTS=xxx.ngrok.io

Y luego ejecuta d/unicorn.

4 Me gusta

Eso siempre termina en

502 Puerta de enlace incorrecta
El servidor devolvió una respuesta inválida o incompleta.