小编cod*_*456的帖子

如何将请求 IP 从 NGINX 转发到 node.js 应用程序?

我有 NGINX 作为反向代理运行,它将所有 http 和 https 流量转发到我的 node.js 应用程序,它侦听 localhost:port

但是,我遇到的问题是 node.js 应用程序将所有传入请求视为来自 ::ffff:127.0.0.1

如何更改 NGINX 配置,以便将真实 IP 传递并转发到 node.js 应用程序?

server {
    listen 80;
    listen [::]:80;
    listen 443;
    listen [::]:443;

    root /var/www/example.com/html;
    index index.html index.htm;

    server_name example.com;

location / {
proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://localhost:myport;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}

 # Requests for socket.io are passed on to Node on port x
  location ~* \.io {
  proxy_set_header X-Real-IP   $remote_addr;
  proxy_set_header …
Run Code Online (Sandbox Code Playgroud)

ubuntu nginx node.js express

11
推荐指数
1
解决办法
5489
查看次数

实施类似whatsapp的视频聊天的最佳SDK?

将类似WhatsApp的视频聊天和文本聊天实现到自己的应用中的最佳方法是什么?可靠性,易于集成和归档以及最终定价。

videochat webrtc

1
推荐指数
1
解决办法
1202
查看次数

标签 统计

express ×1

nginx ×1

node.js ×1

ubuntu ×1

videochat ×1

webrtc ×1