我收到一个错误400:错误的请求在自定义的Heroku域,但在foo.herokuapp.com上正常工作 [英] I get an Error 400: Bad Request on custom Heroku domain, but works fine on foo.herokuapp.com

查看:131
本文介绍了我收到一个错误400:错误的请求在自定义的Heroku域,但在foo.herokuapp.com上正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚把Django项目推送到Heroku。它可以在 http://rtd-staging.herokuapp.com/rtd2015/ 上正常工作,但由于某些原因我得到一个400错误:当我访问它时使用错误的请求: http://staging.researchthroughdesign.org/rtd2015/



我知道CNAME设置正确,因为在推送到heroku的过程中,它表示Heroku应用程序已经崩溃,所以它肯定指向正确的应用程序。 p>

这是错误的日志:

  2014-04-23T18 :32:29.981976 + 00:00 heroku [router]:at = info method = GET path = / host = staging.researchthroughdesign.org request_id = b8fe3ac9-e062-493b-b3bf-862c60e4001b fwd =82.34.146.252dyno = web .1 connect = 1ms service = 7ms status = 400 bytes = 226 


解决方案

您必须将您的网站域设置为允许的主机。将其放在您的 settings.py 中:

  ALLOWED_HOSTS = [。 herokuapp.com,.researchthroughdesign.org] 


I've just pushed a Django project up to Heroku. It works fine at http://rtd-staging.herokuapp.com/rtd2015/, but for some reason I get a 400 error: Bad Request when I visit it using: http://staging.researchthroughdesign.org/rtd2015/

I know that the CNAME was setup correctly because during the process of pushing up to heroku it said that the Heroku app had crashed, so it was definitely pointing to the correct app.

Here is the log for the error:

2014-04-23T18:32:29.981976+00:00 heroku[router]: at=info method=GET path=/ host=staging.researchthroughdesign.org request_id=b8fe3ac9-e062-493b-b3bf-862c60e4001b fwd="82.34.146.252" dyno=web.1 connect=1ms service=7ms status=400 bytes=226

解决方案

You have to set your website domain as an allowed host. Place this in your settings.py:

ALLOWED_HOSTS = [".herokuapp.com", ".researchthroughdesign.org"]

这篇关于我收到一个错误400:错误的请求在自定义的Heroku域,但在foo.herokuapp.com上正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆