-
- Downloads
[FIX] http: disable cache-control header (debug) for wkhtmltopdf
Activate developer mode, generate a report (print an invoice) The report will have missing pieces, like the footer or some part of the header. This is probably caused by wkhtmltopdf not loading properly some resources Wkhtmtopdf generate the same warning message for every problematic resource: "Warning: Received createRequest signal on a disposed ResourceObject's NetworkAccessManager. This might be an indication of an iframe taking too long to load." Related issue on wkhtmltopdf project page: wkhtmltopdf/wkhtmltopdf#1865 wkhtmltopdf/wkhtmltopdf#3933 wkhtmltopdf/wkhtmltopdf#2565 The problem is located in the response that wkhtmltopdf receive: in debug mode the header of the response contains 'Cache-Control: no-cache' which probably create a race condition during the rendering while a second request is attempted to verify the resources. Adding a raw user agent check to not include this header directive fix the problem Notes from odony: We've considered some alternative solutions to preserve the purpose of the DisableCacheMiddleware without having to explicitly test for wkhtmltopdf. * 'Cache-Control: no-cache' (current behavior) breaks wkhtmltopdf rendering * 'Cache-Control: no-store' breaks wkhtmltopdf rendering too * 'Cache-Control: max-age=0' breaks wkhtmltopdf rendering too. It works when increasing the delay to a few seconds, but no magic value will work for very long documents, or it will stop serving its purpose, so it's not a viable option. * 'Cache-Control: must-revalidate' does not break wkhtmltopdf rendering (no duplicate requests at all), but it is not clear from the RFC (https://tools.ietf.org/html/rfc7234#section-5.2.2.1 ) that it will have the intended effect for our middlewar opw-2086708 Closes #38394 closes odoo/odoo#39236 Signed-off-by:Nicolas Martinelli (nim) <nim@odoo.com>
Please register or sign in to comment