From a02e426669119d6c633dce5186ea06e8578989a2 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 11 Feb 2020 12:41:15 +0000 Subject: [PATCH] [FIX] web: 404 response even if placeholder - Open any product kanban view with missing images A 404 status code is returned for missing images, while they are replaced by a placeholder. This can cause issues when configuring a specific 404 page in a reverse proxy: the proxy will serve the custom page instead of the placeholder. opw-2192663 opw-2192340 closes odoo/odoo#45157 X-original-commit: 2719c8a0e40f318787b4d7a46626de46a8fd33f0 Signed-off-by: Nicolas Martinelli (nim) --- addons/web/controllers/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index cdc43a07c6e..1fece767a0d 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1464,6 +1464,10 @@ class Binary(http.Controller): placeholder_content = Binary.placeholder(image=placeholder_filename) else: placeholder_content = Binary.placeholder() + # Since we set a placeholder for any missing image, the status must be 200. In case one + # wants to configure a specific 404 page (e.g. though nginx), a 404 status will cause + # troubles. + status = 200 image_base64 = base64.b64encode(placeholder_content) if not (width or height):