DEV Community

loading...

Expose local server over SSL? (Messenger bot)

Barney
I'm a senior software engineer :)
・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 (9)

Collapse
eruizdechavez profile image
Erick Ruiz de Chavez

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.

Collapse
sovietspy2 profile image
Barney Author

This is good! Thanks for this!

Collapse
joshuatz profile image
Joshua Tzucker

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.

Collapse
sovietspy2 profile image
Barney Author

Nice hack! 👌

Collapse
sovietspy2 profile image
Barney Author

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

Collapse
jinoantony profile image
Jino Antony

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

Collapse
tienloinguyen22 profile image
sese22

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

Collapse
memahesh profile image
Medam Mahesh

You can use Heroku, right.