- https://localhost.run - tunnel over ssh
- https://github.com/ekzhang/bore/releases - tunnel with own client
Assume webserver at localhost:8080
Will not works for Self-signed certificate
$ ssh -R 80:localhost:8080 [email protected]
Seems using of ssh key allows to generate a static public url:
$ ssh -o "IdentitiesOnly=yes" -i /Users/me/.ssh/id_ed25519 -R 80:localhost:8080 localhost.run
urls looks like https://<random_string>.lhr.life
Works with Self-signed certificate
Seems using the same port allows to generate a static public url
download binary https://github.com/ekzhang/bore/releases
./bore local 8080 --to bore.pub -p [>1024]
urls looks like https://bore.pub:43024
- Install http-server with nmp
$ npm install -g http-server
Start server
$ http-server -p 8080 -a 127.0.0.1 <path_to_http_root>
- Create private key and pubic cert
$ openssl genrsa 2048 > key.pem
$ openssl req -x509 -days 1000 -new -key key.pem -out cert.pem
Start server with SSL
$ http-server --ssl -c-1 -p 8080 -a 127.0.0.1 <path_to_http_root>
requirements.txt
requests
flask
server.py
#!/usr/bin/env python3
# encoding: utf-8
#
# install deps:
# pip3 install -r requirements.txt
#
# to start server:
# python3 server.py
#
import json
import random
from flask import Flask, request, jsonify
app = Flask(__name__)
# ROUTS
@app.route('/',methods=['GET'])
def index():
return f"Hello world!"
@app.route('/hello/<param_val>',methods=['GET', 'POST'])
def hello(param_val):
return f"Param = {str(param_val)}"
# ERROR HANDLING
@app.errorhandler(400)
def bad_request(e):
return '', e.code
@app.errorhandler(404)
def not_found(e):
return '', e.code
@app.errorhandler(500)
def server_error(e):
return '', e.code
# START SERVER
if __name__ == '__main__':
# http
app.run(host='0.0.0.0', port=8080,debug=True)
# https
# app.run(host='0.0.0.0', port=8080,debug=True,ssl_context='adhoc')
# or
# app.run(host='0.0.0.0', port=8080,debug=True,ssl_context=('cert.pem', 'key.pem'))