Home > database >  Cisco Yang Suite - NGINX HTTP Host Header Error
Cisco Yang Suite - NGINX HTTP Host Header Error

Time:02-01

I installed Cisco Yang Suite using this repo

After running through the bash script and it comes up I get HTTP 400 Bad Request from a remote machine and in the debug, I get the bellow error.

docker-yangsuite-1  | [31/Jan/2023 10:27:50] ERROR [django.security.DisallowedHost:75] Invalid HTTP_HOST header: 'enauto.homelab.com:8443'. You may need to add 'enauto.homelab.com' to ALLOWED_HOSTS.

I navigate into production.py script and amend the allowed hosts to the below but still get the error even after removing the images and re-composing.

if 'DJANGO_ALLOWED_HOSTS' in os.environ:
    ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', 'localhost').split()
else:
    ALLOWED_HOSTS = 'localhost','enauto.homelab.com','192.168.1.51'

I am expecting to navigate to the web front end of the application

Thank you in advance.

CodePudding user response:

If you ran the start_yang_suite.sh script from that repo, a file called yangsuite/setup.env is created (see source), that contains the DJANGO_ALLOWED_HOSTS env var, so the production.py part will not run the else, but use the env-file's value.

So if you just add you domain to the env file, you should be fine. Default seperator for split() is a white space, so

DJANGO_ALLOWED_HOSTS="localhost enauto.homelab.com"

should be good to go.

  • Related