Closed sreenivasgajula closed 2 years ago
The "A.B.C.D" is just a representation of an actual IP address which might be something like "10.10.10.10". For tight security, you need to add the IP address that is used to reach the running instance of yangsuite. In other words, the IP address of the box that is running yangsuite, and then, from any browser, go to the IP address:port.
There is a yangsuite/production.py file that has ALLOWED_HOSTS listed in it. Add your IP address there. Once you have made the addition to ALLOWED_HOSTS, run docker-compose up --build
to add the changes to your container.
Hi Miott! I made the below changes to "production.py" file and none of them seem to work:
I get this error when I run the "start_yang_suite.sh"
**Building docker containers... ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.**
Appreciate your help! Looking forward to use this tool to play with the yang models!
@miott ^^^ please have a look
What worked for me was to edit DJANGO_ALLOWED_HOSTS in start_yang_suite.sh and re-run ./start_yang_suite.sh to overwrite setup.env and verify there weren't any errors via console output.
Once all good, start it normally with docker compose. (Note addresses are separated by a space, commas wouldn't work.)
--- start_yang_suite.sh.old
+++ start_yang_suite.sh
@@ -87,7 +87,7 @@
MEDIA_ROOT=/ys-data/
STATIC_ROOT=/ys-static/
DJANGO_STATIC_ROOT=/ys-static/
-DJANGO_ALLOWED_HOSTS=localhost
+DJANGO_ALLOWED_HOSTS="localhost 10.0.2.5"
YS_ADMIN_USER=$ADMIN_USER
YS_ADMIN_PASS=$PASS_ONE
YS_ADMIN_EMAIL=$ADMIN_EMAIL
This is what worked for me: yangsuite/docker/yangsuite/production.py In the production.py file, I have remove the if-else block and just added the IP to allowed hosts as shown below: ALLOWED_HOSTS = ['localhost', 'A.B.C.D']
Hello, I have been trying to allow the yangsuite application to serve http requests from various hosts. I see that you have to add the server IP to allowed_hosts to make that happen based on the error below: yangsuite_1 | [21/Jun/2022 16:03:19] ERROR [django.security.DisallowedHost:74] Invalid HTTP_HOST header: 'A.B.C.D:8443'. You may need to add 'A.B.C.D' to ALLOWED_HOSTS. I have made below change and it didn't seem to help docker/start_yang_suite.sh --> line 90 DJANGO_ALLOWED_HOSTS=['localhost', 'A.B.C.D']
I restarted the docker application too. Let me know if I'm missing something else here.
I saw this other post where they mention editing "/yangsuite/docker/yangsuite/setup.env", but I don't see "setup.env" in that directory. https://github.com/CiscoDevNet/yangsuite/issues/43#issuecomment-1068272164