Skip to content
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

Any instruction on how to self host mitm? #242

Open
2niuhe opened this issue Aug 3, 2021 · 6 comments · May be fixed by #248
Open

Any instruction on how to self host mitm? #242

2niuhe opened this issue Aug 3, 2021 · 6 comments · May be fixed by #248

Comments

@2niuhe
Copy link

2niuhe commented Aug 3, 2021

I use this package in an angular project, everything works fine in dev env.

I need to deploy to a production environment isolated from the Internet, the production environment cannot access github.io

I am new to javascript, and i have tried to clone the code and self host the mitm.html with a local python https server.

from http.server import HTTPServer, BaseHTTPRequestHandler
import ssl


httpd = HTTPServer(('localhost', 4443), BaseHTTPRequestHandler)

httpd.socket = ssl.wrap_socket (httpd.socket, 
        keyfile="path/to/key.pem", 
        certfile='path/to/cert.pem', server_side=True)

httpd.serve_forever()

after exec the python script, i can open the https://localhost:4443/mitm.html in browser.

I also config the streamSaver.mitm='https://localhost:4443/mitm.html'. But when i try to write the fetch stream to disk, nothing happened.

Any help or instruction about self host mitm?

@peachyclem
Copy link

You need to copy over /mitm.html and /sw.js into your public folder and assign streamSaver.mitm = '/mitm.html'

You are most likely getting an error that sw.js is not loading.

@guest271314
Copy link

If you are using a Python server locally aioquic and WebTransport can be used to stream content to local file system.

@JounQin
Copy link

JounQin commented Sep 19, 2021

The default mitm.html is not safe to use in Firefox. Maybe this should be documented better.

image

@jimmywarting
Copy link
Owner

Would you like to submit a PR?

@JounQin
Copy link

JounQin commented Sep 19, 2021

Would you like to submit a PR?

OK, I'll give a try.

JounQin added a commit to JounQin/StreamSaver.js that referenced this issue Sep 19, 2021
@JounQin JounQin linked a pull request Sep 19, 2021 that will close this issue
@miwels
Copy link

miwels commented Jul 7, 2023

I would like to reopen this conversation to ask if it's possible to bundle the 'mitm.html' file instead of accessing it through a URL.

I'm creating a library using StreamSaver and would like to store the 'mitm.html' file in my assets in order to load it in the library.

streamsaver.mitm = './assets/mitm.html
or
streamsaver.mitm = 'file://assets/mitm.html

Any idea if this is possible?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants