Charca / bootbot

Facebook Messenger Bot Framework for Node.js
MIT License
974 stars 252 forks source link

Can't access express server to setup ssl #110

Open mchingiz opened 6 years ago

mchingiz commented 6 years ago

Hi, I was using heroku for messenger bot, now I want to move it to my own server. Because facebook wants webhook to be served from https, I am trying to setup ssl. But I don't have access to express server used in bootbot.

I tried to setup my own express server on port 3000 and bootbot server on 3100, then proxy all requests to port 3100 by using express-http-proxy module. But I have ended up with this error: Couldn't validate the request signature. I have checked other issues for this error(#14, #48, #84, #66, #67), mainly they say that problem originates from invalid APP_SECRET, but that's not the case with me.

So how can I setup ssl?

mchingiz commented 6 years ago

I ended up using the second solution. I have created https server on port 3000, submitted that port as webhook, then redirected all requests to bootbot server on port 3100

app.post('*', function(req, res) {
        var url = "http://" + ipAddress + ":3100" + req.url;
        res.redirect(307,url);
});

I am not sure but I think it took a little while to take effect. I don't know why and couldn't recreate the situation.

I still think, it would be greate if we were able to create https server on bootbot by providing certificates.

mraaroncruz commented 6 years ago

You could put it behind nginx. Then have nginx handle the https. Or maybe something lighter weight like caddy which is https only (backed by letsencrypt):