Code

#20148 closed Bug (invalid)

Error 404 cause exception 500

Reported by: ti@… Owned by: nobody
Component: Python 2 Version: 1.5
Severity: Normal Keywords: HTTP 404, HTTP 500
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

Hi,

With Django 1.5, when I set DEBUG = False and go to production (at webfaction) or when I use manage.py runserver that error crash the server. So, I need stop it and start it again (restart dosn't work).

The error: when I access a url not found the error (with DEBUG = False) returns a HTTP error 500 and crash the server with WSGI script.

Tks,
Leo

Attachments (0)

Change History (3)

comment:1 Changed 13 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Could you please give us a traceback of the error?

comment:2 Changed 13 months ago by anonymous

raceback (most recent call last):

File "/home/zarafalcao/webapps/app_site/lib/python2.7/django/core/handlers/base.py", line 92, in get_response

response = middleware_method(request)

File "/home/zarafalcao/webapps/app_site/lib/python2.7/django/middleware/common.py", line 57, in process_request

host = request.get_host()

File "/home/zarafalcao/webapps/app_site/lib/python2.7/django/http/request.py", line 72, in get_host

"Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host)

SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): www.app-facil.com

<WSGIRequest
path:/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'DOCUMENT_ROOT': '/usr/local/apache2/htdocs',

'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4',
'HTTP_CONNECTION': 'close',
'HTTP_FORWARDED_REQUEST_URI': '/',
'HTTP_HOST': 'www.app-facil.com',
'HTTP_HTTPS': 'off',
'HTTP_HTTP_X_FORWARDED_PROTO': 'http',
'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31',
'HTTP_X_FORWARDED_FOR': '189.123.138.39',
'HTTP_X_FORWARDED_HOST': 'www.app-facil.com',
'HTTP_X_FORWARDED_PROTO': 'http',
'HTTP_X_FORWARDED_SERVER': 'www.app-facil.com',
'HTTP_X_FORWARDED_SSL': 'off',
'PATH_INFO': u'/',
'PATH_TRANSLATED': '/home/zarafalcao/webapps/app_site/myproject/myproject/wsgi.py/',
'QUERY_STRING': ,
'REMOTE_ADDR': '127.0.0.1',
'REMOTE_PORT': '43263',
'REQUEST_METHOD': 'GET',
'REQUEST_URI': '/',
'SCRIPT_FILENAME': '/home/zarafalcao/webapps/app_site/myproject/myproject/wsgi.py',
'SCRIPT_NAME': u
,
'SERVER_ADDR': '127.0.0.1',
'SERVER_ADMIN': '[no address given]',
'SERVER_NAME': 'www.app-facil.com',
'SERVER_PORT': '80',
'SERVER_PROTOCOL': 'HTTP/1.0',
'SERVER_SIGNATURE': ,
'SERVER_SOFTWARE': 'Apache/2.2.17 (Unix) mod_wsgi/3.4 Python/2.7.3',
'mod_wsgi.application_group': 'web346.webfaction.com|',
'mod_wsgi.callable_object': 'application',
'mod_wsgi.enable_sendfile': '0',
'mod_wsgi.handler_script':
,
'mod_wsgi.input_chunked': '0',
'mod_wsgi.listener_host': ,
'mod_wsgi.listener_port': '28023',
'mod_wsgi.process_group': 'app_site',
'mod_wsgi.queue_start': '1364423849605156',
'mod_wsgi.request_handler': 'wsgi-script',
'mod_wsgi.script_reloading': '1',
'mod_wsgi.version': (3, 4),
'wsgi.errors': <mod_wsgi.Log object at 0x7fe4fc705970>,
'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0x7fe51c738b70>,
'wsgi.input': <mod_wsgi.Input object at 0x7fe4fc7058b0>,
'wsgi.multiprocess': True,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}>

comment:3 Changed 13 months ago by charettes

  • Resolution set to invalid
  • Status changed from new to closed

Looking at the traceback it looks like you didn't set ALLOWED_HOSTS.

Please have a look at the documentation.

Reopen if it doesn't solve it for you.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.