node.js - 保护我的 HTTP 连接

标签 node.js http https arduino jwt

我目前正在从事家庭自动化项目。以下是我的设置。

A ESP8266 WiFi module will be connected to various sensors. A light web server will be running on the module. There will be a Linode Cloud deployed running certain NodeJS scripts and MongoDB database. The mobile application(Client) will be sending requests to cloud to control and monitor various sensors. I will be securing the connection between the application and cloud using JSON Web Tokens. Also I will try to use HTTPS to secure this connection.

我对如何保护云服务器和 ESP8266 模块之间的通信感到困惑。我做了很多研究。了解了某些概念,但无法获得清晰完整的画面。有人请指导我。谢谢。

最佳答案

在所有应用程序的 header 中使用 token 。 当您发送请求时,它看起来像这样:

request.post({
  url: 'https://mycoolserver.com/',
  headers: {
    Authorization: 'lalalablablabla'
  }
})

更新:就您发送请求而言,该端的服务器会检查您的 token 是否与他拥有的 token 匹配。有很多安全技巧可以确保您的 token 安全,我建议的这个是非常基本的安全措施,但您可以在飞行中轻松做到这一点。稍后您可以提高安全级别。

关于node.js - 保护我的 HTTP 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44199713/

相关文章:

node.js - ng serve编译后如何使用命令提示符

node.js - 搭建AppRTC服务器

ruby-on-rails - 如何在 Faraday 中启用日志记录主体

JAVA:通过 HTTPS POST 数据似乎没有发送?

ssl - 配置 Nginx 将客户端证书转发到后端

node.js - 如何在Docker容器中运行我的React应用

javascript - 提交表单后Node JS重定向

performance - nodejs http 和 redis,只有 6000req/s

等待锁定释放时的 Http Statuscode 需要很长时间?

java - 无法在 Java 中设置客户端 X509 身份验证