{"id":57,"date":"2013-07-05T05:59:30","date_gmt":"2013-07-04T20:59:30","guid":{"rendered":"http:\/\/blog.ymyzk.com\/?p=57"},"modified":"2014-12-03T09:57:10","modified_gmt":"2014-12-03T00:57:10","slug":"django-allowed_hosts","status":"publish","type":"post","link":"https:\/\/blog.ymyzk.com\/2013\/07\/django-allowed_hosts\/","title":{"rendered":"Django 1.5\u4ee5\u964d\u3067\u306fALLOWED_HOSTS\u306e\u8a2d\u5b9a\u304c\u5fc5\u8981"},"content":{"rendered":"

Django 1.5\u4ee5\u964d\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb(settings.py)\u306b\u306f, \u65b0\u305f\u306bALLOWED_HOSTS<\/a>\u3068\u3044\u3046\u9805\u76ee\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f. \u3053\u308c\u3092\u8a2d\u5b9a\u3057\u306a\u3044\u5834\u5408, DEBUG=False\u306e\u6642\u306f\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u307e\u3059\u304c, DEBUG=True\u306e\u3068\u304d\u306f500 Internal Server Error\u3068\u306a\u308a, \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u52d5\u4f5c\u3057\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059. Django 1.5\u3088\u308a\u3082\u524d\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3059\u308b\u969b\u306b\u306f\u7279\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059.<\/p>\n

<\/p>\n

ALLOWED_HOST\u306b\u306f\u516c\u958b\u3059\u308b\u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d\u3092\u8a18\u5165\u3059\u308c\u3070\u826f\u3044\u306e\u3067, www.example.com\u3068\u3044\u3046\u30b5\u30a4\u30c8\u3092\u516c\u958b\u3059\u308b\u969b\u306b\u306fsettings.py\u5185\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u5165\u3059\u308c\u3070OK\u3067\u3059.<\/p>\n

\r\nALLOWED_HOSTS = ["www.example.com"]\r\n<\/pre>\n

ALLOWED_HOST\u306f\u5f8c\u8ff0\u3059\u308b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u7406\u7531\u306b\u3088\u308a, FQDN\u3067\u6307\u5b9a\u3059\u308b\u306e\u304c\u671b\u307e\u3057\u3044\u3067\u3059\u304c, \u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u3092\u7528\u3044\u308b\u3053\u3068\u3082\u51fa\u6765\u307e\u3059.<\/p>\n

\r\nALLOWED_HOSTS = ["*.example.com"]\r\nALLOWED_HOSTS = ["*"]\r\n<\/pre>\n

ALLOWED_HOST\u306b\u3064\u3044\u3066Django 1.5\u306eDocumentation<\/a>\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8a18\u8ff0\u304c\u3042\u308a\u307e\u3059.<\/p>\n

A list of strings representing the host\/domain names that this Django site can serve. This is a security measure to prevent an attacker from poisoning caches and password reset emails with links to malicious hosts by submitting requests with a fake HTTP\u00a0Host<\/tt>header, which is possible even under many seemingly-safe webserver configurations.<\/p><\/blockquote>\n

ALLOWED_HOST\u3092\u9069\u5207\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u30dd\u30a4\u30ba\u30cb\u30f3\u30b0\u7b49\u3092\u9632\u3050\u3054\u3068\u306b\u7e4b\u304c\u308a, \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u9ad8\u3081\u3066\u304f\u308c\u308b\u3088\u3046\u3067\u3059.<\/p>\n","protected":false},"excerpt":{"rendered":"

Django 1.5\u4ee5\u964d\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb(settings.py)\u306b\u306f, \u65b0\u305f\u306bALLOWED_HOSTS\u3068\u3044\u3046\u9805\u76ee\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f. \u3053\u308c\u3092\u8a2d\u5b9a\u3057\u306a\u3044\u5834\u5408, DEBUG=False\u306e\u6642\u306f\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u307e\u3059\u304c, DEBUG= […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[12,15,14],"_links":{"self":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/57"}],"collection":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":7,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"predecessor-version":[{"id":663,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/57\/revisions\/663"}],"wp:attachment":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}