Allowed Host Setting for Django on EC2

こ雲淡風輕ζ 提交于 2019-12-05 08:08:51

Set it to -

ALLOWED_HOSTS = [
  '.yourdomain.com'
]

Where yourdomain.com is the domain name you're using to access it.

The documentation says -

Values in this list can be fully qualified names (e.g. 'www.example.com'), in which case they will be matched against the request’s Host header exactly (case-insensitive, not including port). A value beginning with a period can be used as a subdomain wildcard: '.example.com' will match example.com, www.example.com, and any other subdomain of example.com.

When you set it to www.yourdomain.com, there must have been some request to another subdomain, other than www. Which caused the trouble. I cannot say exactly because I don't have that much information.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!