Closed Bug 1303853 Opened 8 years ago Closed 8 years ago

Error templates depend on request

Categories

(Socorro :: Webapp, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: peterbe, Assigned: peterbe)

Details

Attachments

(1 file)

For example, see https://sentry.prod.mozaws.net/operations/socorro-prod/issues/337802/
This has happened over 1,000 times in the last 30 days. The error happens because when you go to  https://052.035.146.173/ (instead of crash-stats.mozilla.com) Nginx lets the request through uWSGI to Django. Django does not have this hostname in its settings.ALLOWED_HOSTS so it raises a DisallowedHost error which means it tries to render our 400.html template [0] which in turn is dependent on "crashstats_base.html" which in turn depends on "requests" which you can't use during an error. 

Also in 500.html [1] we build a link to bugzilla with parameters and that depends on requests which you can't use. 

At first I thought I'd just add more blocks and if statements to crashstats_base.html but the ideal is to NOT do anything advanced during the rendering of any of the 500.html or 4xx.html template renderings. 

[0] https://github.com/mozilla/socorro/blob/master/webapp-django/crashstats/base/jinja2/400.html
[1] https://github.com/mozilla/socorro/blob/793a2b01ad58b2143df523afe515471bfb03551e/webapp-django/crashstats/base/jinja2/500.html#L21
Commit pushed to master at https://github.com/mozilla/socorro

https://github.com/mozilla/socorro/commit/bd1b798c6b57cff1736ac3b0bb3ecdebc8664c3c
fixes bug 1303853 - Error templates depend on request (#3475)

* fixes bug 1303853 - Error templates depend on request

* remove handler400 that wasn't used
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: