electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.57k stars 1.73k forks source link

electron-updater: Turn off "noCache" query param #3415

Open adammeyer opened 5 years ago

adammeyer commented 5 years ago

How can I turn off the noCache query param? We are managing caching via the HTTP cache headers. It's a 'generic' update provider.

adammeyer commented 5 years ago

For anyone else interested in removing the param, here is a hack I found:

autoUpdater.requestHeaders = { authorization: '' };

develar commented 5 years ago

Could you please explain for what do you need cache if updater in any case need to get latest.yaml and then downloads update only if need?

adammeyer commented 5 years ago

We cache latest.yaml on our cdn for 20 minutes to reduce the load on our update server. The noCache param would never return a hit from the cdn.

adammeyer commented 5 years ago

If I make a PR adding a setting to make the noCache param optional, do you think that would get merged in? I feel like using the noCache param is hacky. The HTTP Cache-Control header should be used to control caching for http requests.

develar commented 5 years ago

@adammeyer Do you use cloud front? Or custom server, so it is not possible to add exclusion by URL pattern?

develar commented 5 years ago

I feel like using the noCache param is hacky. The HTTP Cache-Control header should be used to control caching for http requests

electron-updater and electron-builder is widely used. Even if for 5% it is useful, it should be so. Price — not working auto update if proxy server caches incorrectly.

adammeyer commented 5 years ago

I think having it on by default is fine. I would just like to see an option to turn it off if it's not needed or desired.

amiller-gh commented 5 years ago

fwiw, I would also appreciate the ability to opt-out of noCache – my releases are behind cloudflare for free caching, and we're making good use of etags from our host, so theres no reason for the requestor to manually invalidate. Yes, we can use an exclusion pattern, but configuring this in source is more transparent to other developers that may have to tinker with our deployment infra down the line.