How to run canister on public network?

by default : 127.0.0.1:8000
change[“bind”: “127.0.0.1:8000”,] to [“bind”: “0.0.0.0:8000”,]
local access is normal.
remote access :
http://192.168.1.9:8000/?canisterId=cxeji-wacaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q

An error happened:
TypeError: Cannot read property ‘digest’ of undefined
at u (http://192.168.1.9:8000/bootstrap.js:2:69245)
at c (http://192.168.1.9:8000/bootstrap.js:2:69410)
at http://192.168.1.9:8000/bootstrap.js:2:69571
at Array.map ()
at Object.t.requestIdOf (http://192.168.1.9:8000/bootstrap.js:2:69546)
at http://192.168.1.9:8000/bootstrap.js:2:143021
at async t.HttpAgent.read (http://192.168.1.9:8000/bootstrap.js:2:135353)
at async r.retrieve (http://192.168.1.9:8000/bootstrap.js:2:43151)
at async _loadJs (http://192.168.1.9:8000/bootstrap.js:2:236375)
at async _main (http://192.168.1.9:8000/bootstrap.js:2:237265)

I think the issue is because 192.168.1.9 is not considered as a secure context and so your browser doesn’t load the SubtleCrypto API ( https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto ), while http://localhost (or 127.0.0.1) is considered as secure.

try typing isSecureContext in the webconsole, if it returns false it means that you need to serve this endpoint via SSL

2 Likes

This URL (http://192.168.1.9:8000/ ) can be opened local machine,Not on other machines.

This is not considered as a secure context for your browser

I’d advise to run a local reverse proxy (mitmproxy https://mitmproxy.org/ or nginx ) that points to this ip address.

mitmproxy -p 8999 --mode reverse:http://192.168.1.9:8000
# access http://localhost:8999/?canisterId=....

Or serve your 192.168.1.9 endpoint behind TLS/SSL

1 Like

Hi, I have to reply 3 times here before I can post, so…

That’s fine. Thank you very much!