[Django] Invalid HTTP_HOST header: '[HOST]'. You may need add '[HOST]' to ALLOWED_HOSTS

[Django] Invalid HTTP_HOST header: '[HOST]'. You may need add '[HOST]' to ALLOWED_HOSTS

Goal

  • To solve “Invalid HTTP_HOST header: ‘[HOST]’. You may need add ‘[HOST]’ to ALLOWED_HOSTS”’ problem.


Intro

  • When I connected my Django REST server by domain likes this ‘http://iot.dorbae.kr:8000/~’, this error occured and I wasn’t able to connect the server.

screenshot001


Practice

1. Add allowed host

1.1. Open setting.py file in your djang project

1.2. Add allowed hosts

  • [‘*’] : Allow all
  • [‘localhost’] or [‘localhost’, ‘iot.dorbae.kr’, ‘10.12.33.55’] : Allow specific hosts

screenshot002



References

댓글남기기

-->