备注:
    即时消息的安全对于我们来说是比较重要的,作者在设计Nchan 的时候已经考虑了
a. nchan_authorize_request (Hooks and Callbacks)可以集成后端服务
  配置如下:
  upstream my_app {
    server 127.0.0.1:8080;
  }
  location = /auth {
    proxy_pass http://my_app/pubsub_authorize;
    proxy_pass_request_body off;
    proxy_set_header Content-Length "";
    proxy_set_header X-Subscriber-Type $nchan_subscriber_type;
    proxy_set_header X-Publisher-Type $nchan_publisher_type;
    proxy_set_header X-Prev-Message-Id $nchan_prev_message_id;
    proxy_set_header X-Channel-Id $nchan_channel_id;
    proxy_set_header X-Original-URI $request_uri;
    proxy_set_header X-Forwarded-For $remote_addr;
  }
 
  location ~ /pubsub/auth/(\w+)$ {
    nchan_channel_id $1;
    nchan_authorize_request /auth;
    nchan_pubsub;
    nchan_channel_group test;
  }
                           
b. 使用内部channel ,控制访问ip
                           
// 只能内部访问
http {
  server {
    #available only on localhost
    listen  127.0.0.1:8080;
    location ~ /pub/(\w+)$ {
      nchan_publisher;
      nchan_channel_group my_app_group;
      nchan_channel_id $1;
    }
  }
 
  server {
    #available to the world
    listen 80;
 
    location ~ /sub/(\w+)$ {
      nchan_subscriber;
      nchan_channel_group my_app_group;
      nchan_channel_id $1;
    }
  }
}
  // ip 过滤
  server {
    #available to the world
    listen 80;
    location ~ /pub/(\w+)$ {
      allow 127.0.0.1;
      deny all;
      nchan_publisher;
      nchan_channel_group my_app_group;
      nchan_channel_id $1;
    }
c. 对于重要的,外部服务进行加密
                     
  http {
  server {
    #available only on localhost
    listen  127.0.0.1:8080;
    #...publisher endpoint config
  }
  server {
    #available to the world
    listen 443 ssl;
    #SSL config goes here
    location ~ /sub/(\w+)$ {
      nchan_subscriber;
      nchan_channel_group my_app_group;
      nchan_channel_id $1;
    }
  }
}
 
 
 
 
 

Nchan 实时消息 安全配置的更多相关文章

  1. Nchan 实时消息ha 配置

    备注:      Nchan 的数据持久化,以及ha 都是通过redis实现的,如果要做到无单点可以使用redis cluster     同对于Nchan server 进行多副本   1. 安装 ...

  2. Nchan 实时消息内置变量

      以下参考官方文档:   $nchan_channel_idThe channel id extracted from a publisher or subscriber location requ ...

  3. 实时消息平台NSQ的特性

    NSQ是GO语言开发的可用于大规模系统中的实时消息服务,但是和RabbitMQ等相比,它具有什么特色,什么场景下选择NSQ呢? NSQ的自身特色很明显,最主要的优势在如下三个方面: 1,性能.在多个著 ...

  4. NSQ:分布式的实时消息平台

    NSQ是一个基于Go语言的分布式实时消息平台,它基于MIT开源协议发布,代码托管在GitHub,其当前最新版本是0.3.1版.NSQ可用于大规模系统中的实时消息服务,并且每天能够处理数亿级别的消息,其 ...

  5. 开源实时消息推送系统 MPush

    系统介绍 mpush,是一款开源的实时消息推送系统,采用java语言开发,服务端采用模块化设计,具有协议简洁,传输安全,接口流畅,实时高效,扩展性强,可配置化,部署方便,监控完善等特点.同时也是少有的 ...

  6. Centrifugo  语言无关的实时消息服务

    Centrifugo 语言无关的实时消息服务,基于golang编写,提供了websocket 以及sockjs 的兼容处理,使用上很简单 同时也支持基于redis的扩展,以下是一个简单的运行测试 环境 ...

  7. 未读消息(小红点),前端与 RabbitMQ实时消息推送实践,贼简单~

    前几天粉丝群里有个小伙伴问过:web 页面的未读消息(小红点)怎么实现比较简单,刚好本周手头有类似的开发任务,索性就整理出来供小伙伴们参考,没准哪天就能用得上呢. 之前在 <springboot ...

  8. 我有 7种 实现web实时消息推送的方案,7种!

    技术交流,公众号:程序员小富 大家好,我是小富- 我有一个朋友- 做了一个小破站,现在要实现一个站内信web消息推送的功能,对,就是下图这个小红点,一个很常用的功能. 不过他还没想好用什么方式做,这里 ...

  9. PHP Web实时消息后台服务器推送技术---GoEasy

    越来越多的项目需要用到实时消息的推送与接收,怎样用php实现最方便呢?我这里推荐大家使用GoEasy, 它是一款第三方推送服务平台,使用它的API可以轻松搞定实时推送! 浏览器兼容性:GoEasy推送 ...

随机推荐

  1. elasticsearch 集群的安装部署

    一 介绍 elasticsearch 是居于lucene的搜素引擎,可以横向集群扩展以及分片,开发者无需关注如何实现了索引的备份,集群同步,分片等,我们很容易通过简单的配置就可以启动elasticse ...

  2. weblogic 12c重置console密码

    su - oracle cd /u02/weblogic/user_projects/domains/base_domain source   bin/setDomainEnv.sh cd /u02/ ...

  3. 已知起始点,获取每段等距离途经点的经纬度(用百度js api作)

    已知两个中文地址,自动规划路径,获取路径上每个3公里的点的经纬度 <html> <head> <meta http-equiv="Content-Type&qu ...

  4. <mvc:annotation-driven>新增标签

    以下为spring mvc 3.1中annotation-driven所支持的全部配置 <mvc:annotation-driven message-codes-resolver =" ...

  5. cacti安装和使用

    关闭selinux 1.搭建lamp环境 配置apache [root@cacti-server ~]# yum -y install httpd [root@cacti-server ~]# sys ...

  6. Apache编译安装

    1.准备好源码包并配置好yum源,需要的源码包包括:httpd-2.4.18.apr-1.5.2.tar.gz.apr-util-1.5.4.tar.gz 2.准备用户 groupadd -r apa ...

  7. PostgreSQL数据库资料(转)

    PostgreSQL数据库资料 转自:http://blog.csdn.net/postgrechina/article/details/49132791 推荐书籍: 概念书籍: <Postgr ...

  8. 一个好工具-everything-可以找到浏览器的所有缓存

    下载路径http://www.voidtools.com/downloads/ 我用它来寻找浏览器缓存的google瓦片.

  9. c++下使用邮槽实现进程间通信

    Windows API提供了邮槽和命名管道两种机制来实现进程间通信,在这里使用C++实现邮槽. 邮槽是Windows提供的一种进程间单向通信的机制,进程中的一方只能读取(或写入)数据,而另一方只能写入 ...

  10. (转)JAVA正则表达式语法大全

    [正则表达式]文本框输入内容控制 整数或者小数:^[0-9]+\.{0,1}[0-9]{0,2}$ 只能输入数字:"^[0-9]*$". 只能输入n位的数字:"^\d{n ...