django_Invalid HTTP_HOST header: '192.168.163.140'. You may need to add '192.168.163.140' to ALLOWED
来源:互联网 发布:闲鱼 淘宝二手电脑 编辑:程序博客网 时间:2024/04/29 21:30
在django启动后,通过web访问启动的django
整个系统报错:
Invalid HTTP_HOST header: '192.168.163.140'. You may need to add '192.168.163.140' to ALLOWED_HOSTS.
问题及处理如下:
首先找到django的settings.py文件对其中的
ALLOWED_HOSTS
Default: [] (Empty list)
表示此Django站点
可以投放的主机/域名的字符串列表。这是防止HTTP主机头部攻击的安全措施,即使在许多看似安全的Web服务器配置下也是如此。
此列表中的值可以是完全限定名称(例如“www.example.com”
),在这种情况下,它们将完全匹配请求的主机标头(不区分大小写,不包括端口)。以期间开头的值可以用作子域通配符:'.example.com'
将匹配example.com
,www.example.com
和example.com的任何其他子域
。值“*”
匹配任何东西;在这种情况下,您有责任提供您自己对Host头
的验证(可能在中间件中);如果是这样,中间件必须首先列在MIDDLEWARE
中)。
Django还允许任何条目的完全限定域名(FQDN)。某些浏览器在主机标头中包含一个后跟点,Django在执行主机验证时将其标记。
如果主机头(或X-Forwarded-Host
(如果USE_X_FORWARDED_HOST
已启用))与此列表中的任何值不匹配,则django.http.HttpRequest.get_host()
方法将引发SuspiciousOperation
。
当DEBUG为True
并且ALLOWED_HOSTS为空
时,主机将针对['localhost','127.0.0.1','[:: 1]']
进行验证。
此验证仅适用于get_host()
;如果您的代码直接从request.META
访问Host头,您将绕过此安全保护。
在Django更改1.10.3: 在旧版本中,如果DEBUG = True,则未检查ALLOWED_HOSTS。这也在Django 1.9.11和1.8.16中改变,以防止DNS重新绑定攻击。
- django_Invalid HTTP_HOST header: '192.168.163.140'. You may need to add '192.168.163.140' to ALLOWED
- DisallowedHost: Invalid HTTP_HOST header: '192.168.0.136'. You may need to add u'192.168.0.136' to A
- dango error:DisallowedHost: Invalid HTTP_HOST header: ''. You may need to add u'' to ALLOWED_HOST
- 让其他机器访问本机的django项目 & 处理 DisallowedHost at / Invalid HTTP_HOST header: '...'. You may need
- JAVA错误:AXIS Web Service Problem: No compiler found in your classpath! (you may need to add ‘tools.ja
- What you may need to know about DBTransaction::postChanges()
- You may need to adjust the proxy settings in Gradle.
- SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
- You may need to configure your browser or application to trust the Charles Root Certificate.
- SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
- sp2-0750:you may need oracle_home to you oracle software directory
- Where am I? You need to setup your server names in class.config.php $_SERVER['HTTP_HOST'] reported
- ubuntu : you may need to re-run your boot loader[grub] 解决办法
- Error initializing Java Runtime Environment. You may need to reinstall Flash
- Error:Unknown host 'android.oa.com'. You may need to adjust the proxy settings in Gradle.
- Unknown host 'android.oa.com'. You may need to adjust the proxy settings in Gradle.
- Unknown host 'android.oa.com'. You may need to adjust the proxy settings in Gradle.
- You may need an appropriate loader to handle this file type
- c++ malloc
- WEEX
- webstrom 里面 angular语法提示
- varchar2 length
- 父传子props
- django_Invalid HTTP_HOST header: '192.168.163.140'. You may need to add '192.168.163.140' to ALLOWED
- React入门狂想曲(序)
- 单元测试、接口测试、功能测试 、的区别
- 单个圆角的设置
- java算法之最大子阵列
- ORACLE SCOTT 解锁 并修改密码
- 22
- The import javax.servlet cannot be resolved
- 一个多线程例子,使用CountDownLatch