كيفية السماح بالمضيفين المخصصة في وضع التطوير

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

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).

لقد جربت DISCOURSE_DEV_HOSTS=xxx.ngrok.io d/unicorn ولكن للأسف لم ينجح الأمر

أفترض أنك تقصد بـ “لم ينجح” أنك لا تزال تحصل على نفس الخطأ الذي ذكره المنشئ الأصلي (OP)؟ يبدو أنك تستخدم Docker للتطوير، لذا تحتاج إلى تعيين متغير البيئة هذا داخل الحاوية، وليس على المضيف. أنا لا أستخدم Docker للتطوير، لكن يبدو أن d/boot_dev يمكنه تعيين المتغيرات داخل الحاوية نيابةً عنك:

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

ثم قم بتشغيل d/unicorn.

هذا ينتهي دائمًا بـ

502 Bad Gateway
أعاد الخادم استجابة غير صالحة أو غير مكتملة.