Should server IP address be in ALLOWED_HOSTS django setting? -


since upgrading django 1.5 logs show several suspiciousoperation exceptions text:

invalid http_host header (you may need set allowed_hosts): <my server's ip> 

is genuinely 'suspicious' request, or should including server's ip address in allowed_hosts setting in addition domain name? idea making requests http_host = "ip address" rather http_host = "domain name"?

here request environment:

{'http_accept_encoding': "'identity'",  'http_connection': "'close'",  'http_host': "'168.62.208.14'",  'http_x_forwarded_protocol': "'https'",  'http_x_real_ip': "'176.10.35.241'",  'http_x_scheme': "'https'",  'path_info': "u'/'",  'query_string': "''",  'raw_uri': "'/'",  'remote_addr': "'127.0.0.1'",  'remote_port': "'45068'",  'request_method': "'get'",  'script_name': "u''",  'server_name': "'168.62.208.14'",  'server_port': "'80'",  'server_protocol': "'http/1.0'",  'server_software': "'gunicorn/0.14.6'",  'gunicorn.socket': "'<socket._socketobject object @ 0x7ab3b40>'",  'wsgi.errors': '"<open file \'<stderr>\', mode \'w\' @ 0x7f0c94810270>"',  'wsgi.file_wrapper': "'<class gunicorn.http.wsgi.filewrapper @ 0x34eec80>'",  'wsgi.input': "'<gunicorn.http.body.body object @ 0x2a0bf10>'",  'wsgi.multiprocess': 'false',  'wsgi.multithread': 'false',  'wsgi.run_once': 'false',  'wsgi.url_scheme': "'http'",  'wsgi.version': '[1, 0]'} 

short answer yes (according provided headers).

long answer: according documentation:

if host header (or x-forwarded-host if use_x_forwarded_host enabled) not match value in list, django.http.httprequest.get_host() method raise suspiciousoperation.

in other words: if requests pass server ip address host header (and apparently do), , think it's okay, yes, should add server ip allowed_hosts.

also, ip address in http_host many reasons, directly ask ip address.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -