GitbookIO / nuts

:chestnut: Releases/downloads server with auto-updater and GitHub as a backend
http://nuts.gitbook.com
Apache License 2.0
1.25k stars 300 forks source link

Heroku SSL termination breaks Transport Security for downloads #163

Open Eugeny opened 5 years ago

Eugeny commented 5 years ago

When deploying to Heroku, the download URLs will use http:// instead of https:// as getFullUrl() uses req.protocol, which is always 'http' on Heroku

Joshandrews43 commented 5 years ago

I am getting NSURLErrorDomain, code=-1022 when I try to use autoUpdater which I have traced back to this issue as well. Any luck resolving it?

Eugeny commented 5 years ago

I've just patched my instance to force https for the time being

Joshandrews43 commented 5 years ago

@Eugeny Hmm odd, I patched it partially it seems as now I am getting "updates available" but then afterwards am receiving the NSURLErrorDomain message before the download completes / begins. I am running it from a heroku server and have my domain set as: 'https://appname.herokuapp.com/update?version=' + version + '&platform=' + platform;

Potentially has to do with a redirect occuring from the URL above to: 'https://appname.herokuapp.com/update/platform/version', such that the responding URL is not the same as the request? However, when I use the former URL as my initial, it gives me this -1022 error without even checking for updates.

Any ideas why it would all of a sudden be OK with the URL in the beginning (whereas before I wasn't even getting to "checking for updates") and then error for the download portion?

Eugeny commented 5 years ago

@Joshandrews43 check whether your URLs have https:// via the debug endpoint: https://.../update/win32/1

The feed URL format is /update/win32/:version as per https://nuts.gitbook.com/update-windows.html

Joshandrews43 commented 5 years ago

@Eugeny Just solved my problem. I did end up using https, however I just got other errors afterwards. Turns out I had to install the application as a .dmg file to my computer and then issue updates to the heroku server as a .zip otherwise they wouldn't download (on mac). Not sure why; any idea?

ddnetters commented 5 years ago

For people running into this issue it can be solved by setting TRUST_PROXY to true in your heroku config vars