Error templates depend on request

RESOLVED FIXED

Status

Socorro
Webapp
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: peterbe, Assigned: peterbe)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

a year ago
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
(Assignee)

Comment 1

a year ago
Created attachment 8792646 [details] [review]
Link to Github pull-request: https://github.com/mozilla/socorro/pull/3475

Comment 2

a year ago
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

Updated

a year ago
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.