New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: Enable request interception and caching at the same time #5176
Comments
Duplicated of #4620 |
I did tests with or without this hack for over 600 URLs and found something very shocking: So to answer partially of question 2 --- the hack simply will not work in the majority of the cases. Is there any way to make request interception and caching work at same time? Header overrides obviously did not work as many (including myself) have tried: #3403 #4055 |
我也需要 |
@liweixi100 Would you mind sharing the details of your tests? Ideally, we would have a unit test covering this. |
The issue described by @liweixi100 is described in #7038 and solved by #7060. |
Caching is intentionally disabled with page.setRequestInterception(true):
https://github.com/GoogleChrome/puppeteer/blob/d17708ba1fc8411941bfd07f633aaf2fb5cb671e/lib/NetworkManager.js#L154
As a result, all requests sent by Puppeteer carry the headers
Cache-Control: no-cache; Pragma: no-cache
, which disallows any external proxies to serve cached responses.But our application leverages a caching proxy to save bandwidth and improve performance. It would be very important for us to have the caching enabled.
The only I way I found that would make request interception and caching work at the same time is to hack NetworkManager.js and remove
|| this._protocolRequestInterceptionEnabled
at L154. (I think that was also the old behavior until the change introduced by #1154).My questions are:
@aslushnikov
The text was updated successfully, but these errors were encountered: