diff options
| author | Jeremy Kersten <jke@odoo.com> | 2020-03-26 18:07:03 +0000 |
|---|---|---|
| committer | Romain Derie <rde@odoo.com> | 2020-03-26 18:12:47 +0000 |
| commit | a65d27cce98c1b0d303eeaf8f066fe4983afc7a8 (patch) | |
| tree | a8a9a71861ef07cb6d2c55a9ad4a8326a48b475b /addons/website/controllers/main.py | |
| parent | 1606d22d40cd431a02e73bb0661a192bb12edf85 (diff) | |
[IMP] website: perf - favicon.ico cached for 1 year
Note that this route is only used when no icon is set in DOM, such as accessing
a PDF after an order.
task-2211013
Diffstat (limited to 'addons/website/controllers/main.py')
| -rw-r--r-- | addons/website/controllers/main.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index df2bf628660..49cc8160a06 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -487,7 +487,10 @@ class WebsiteBinary(http.Controller): kw['unique'] = unique return Binary().content_image(**kw) + # if not icon provided in DOM, browser tries to access /favicon.ico, eg when opening an order pdf @http.route(['/favicon.ico'], type='http', auth='public', website=True, multilang=False, sitemap=False) def favicon(self, **kw): - # when opening a pdf in chrome, chrome tries to open the default favicon url - return self.content_image(model='website', id=str(request.website.id), field='favicon', **kw) + website = request.website + response = request.redirect(website.image_url(website, 'favicon'), code=301) + response.headers['Cache-Control'] = 'public, max-age=%s' % (365 * 24 * 60) + return response |
