loading...

Expose local server over SSL? (Messenger bot)

sovietspy2 profile image Barney ・1 min read

Hi!

In the past I've been working on a chatbot and now I want to continue development but I can't seem to find a solution to expose my local server over HTTPS. Facebook messenger API only works over HTTPS.

I've read some articles about ngrok but it recently changed plans so the free plan no longer works (no static address which makes development possible but uneasy).

Also I've found another service called serveo.net whichs looked promising but it seems like HTTPS is not supported.

Any suggestion?

Thanks!

Discussion

pic
Editor guide
 

What all these services are doing is basically creating a reverse tunnel, that is, any connection to a specific port on the a remote computer is forwarded back to your computer.

If you have ssh access to a remote computer/server/vps/etc. you could try just creating a reverse tunnel without having to install any additional software. A pretty good how to is available on this Stack Overflow answer. Basically you want to do the ssh -R command.

btw, if you run this, and use -f flag, it will send ssh to the background and you will need to kill -9 it 😉 when you are done.

 

This is good! Thanks for this!

 

The best option is definitely just paying for a service that lets you keep a reserved address (Ngrok, Pagekite, etc.), or running a self-hosted version on your own resource (VPS, Raspberry Pi, etc.). The last time I searched around for a truly "free" and all-in-one option, I came up short (Pagekite is paid BTW, but has a free trial period).

However, if you are desperate for a truly free solution, I actually came up with a workaround that I use with Ngrok; proxy requests to the dynamic Ngrok URL through a static Google Cloud Functions URL. This works, even on GCP's perpetual "free" tier. I've written up this approach here, and you can find the code here.

 

Nice hack! 👌

 

You can use expose which is a free alternative to ngrok.

 

Ngrok can help you achive this. Register an account for unlimited request or you will be restricted number of requests per minute

 
 

Pagekite also exposes local server over https and makes them globally visible. It works like ngrok.
You can check details at - pagekite.net

 

This is pretty cool, testing it out right now! Thanks!