jimmywarting / StreamSaver.js

StreamSaver writes stream to the filesystem directly asynchronous
https://jimmywarting.github.io/StreamSaver.js/example.html
MIT License
3.97k stars 413 forks source link

404 in serviceworker when downloading file #239

Open rowanG077 opened 3 years ago

rowanG077 commented 3 years ago

Hi Jimmy,

Thank you for your hard work on this library! I have an issue which I have no clue what is going on. I'm hosting mitm.html and sw.js myself on a secured server. I point my local dev server to this instances as well as production. On the dev server this works fine. I can streaming download files and I can see it makes a download request succesfully to the URL:

https://xxxx.com/localhost:8080/608211/0ce02f4f-4502-4d15-acc2-4e46c8866f3a.zip

A nice 200 status is returned. But when I publish my app to the same url and then try to streaming download I get a 404 from:

https://xxxx.com/xxxx.com/843365/5f6d3487-1fae-48fd-85ff-21139e991688.zip

Is there something else I need to setup for hosting these files on my own?

jimmywarting commented 3 years ago

Hmm, is the service worker installed successfully. it can't be installed on insecure sites...

rowanG077 commented 3 years ago

the site has https with a valid certificate. For the record the pages in the URLS don't actually exist and will 404 when you go to them with the browser.

But I don't get that locally I can use the remote mitm.html and sw.js fine but when I go to the remote site it doesn't work...

How can I verify the service worker is installed successfully?

allengordon011 commented 3 years ago

@rowanG077 look in the Application tab in Firefox DevTools

rowanG077 commented 3 years ago

I got the service worker to register as I can see console.log I added appearing in the console. But firefox says in the service worker tab that there are no service workers.

Now I no longer get a 404... Just nothing happens.

ramonribeiro96 commented 2 years ago

@rowanG077 did you fix it? I have the same problem. I can access my hosted files (mitm.html and sw.js), but I get a 404 on the download. image

But my sw.js is with pending status, I don't know if it was supposed to behave like this. @jimmywarting image

rowanG077 commented 2 years ago

Yes I was able to fix it by hosting mitm myself.

ramonribeiro96 commented 2 years ago

But then did you register the external sw.js? if you can help me, just so I have a path to follow, thank you

rowanG077 commented 2 years ago

The following notes are important:

The project I used streamsaver for is opensource so you can look at the source: https://github.com/encryption4all/cryptify. I included the stream saver files in the project and deployed them with the app.