1# install on Ubuntu
2sudo snap install ngrok
3
4# connect your account
5ngrok authtoken XXXXXXXXXXXXXjeZhwV6zXXXXXXXXXXpvyAj5yKXXXXXXXXXX
6
7# start tunnel
8ngrok http 443
9
10# point ngrok to your local web server
11# 127.0.0.1:8080 is default url for http-server
12ngrok http 127.0.0.1:8080 -host-header="127.0.0.1:8080"
Keep in mind that ngrok
is not a web server, it won’t work for development. It’s just a tunnel that’ll make your webserver available over HTTPS
1# install
2npm i -g http-server
3
4# go to the folder where all global node modules are installed
5cd `npm root -g`
6
7# go to http-server
8cd http-server/bin
9
10# create an SSL cert
11# https://github.com/http-party/http-server#tlsssl
12# give 127.0.0.1 for common name
13openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
14
15# add alias so it always starts with SSL
16alias http-server='cd $(npm root -g)/http-server/bin/ && ./http-server -S -C cert.pem'
This entire thing is probably flawed since we want to serve within a directory and not want to cd
to node root every time.
If i try to use keys (cert.pem
and key.pem
) from a different directory than the one from where i am running http-server
it fails to find the key.
I guess i have to generate new keys inside every folder where i want to run it?