Wednesday, May 16, 2018

hue后端的django请求HOST为domain时返回400 BAD REQUEST,ip+port则没问题排查思路

通过nginx反向代理到两台hue webserver服务后,发现wget dp-hue_nginx.company.com/hue会返回400 BAD REQUEST, 而请求服务对应的ip:portwget 192.168.1.121:8005/hue则没有问题。

继续找到问题来源,直接对某台hue webserver执行如下命令,发现上述问题可以复现,所以排除掉nginx的问题。
$ curl -I -H 'Host:dp-hue_nginx.corp.kuaishou.com' http://hue-webserver/accounts/login/?next=/
HTTP/1.1 400 BAD REQUEST
$ curl -I -H 'Host:127.0.0.1:8888' http://hue-webserver/accounts/login/?next=/
HTTP/1.1 200 OK
google得到相关post, 说设置allowed_hosts即可,检查$HUE_HOME/desktop/conf/hue.ini, 此参数默认为'*'.
再次google得到此文, 发现是个django的bug。在请求的host domain路径里不能包括下划线(underscore)。

1 comment:

  1. awesome post presented by you..your writing style is fabulous and keep update with your blogs Big data hadoop online course Hyderabad

    ReplyDelete