I want to redirect my websocket to another server. As we known, nginx command rewrite or redirect can

do such a kind of http request, however, they do not work to redirect websocket. I was testing them and

found the solution:

location ~ /ws {
proxy_pass https://domain;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_buffering off;
proxy_redirect off; proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
}

Nginx Redirect Websocket的更多相关文章

  1. Nginx支持WebSocket反向代理-学习小结

    WebSocket是目前比较成熟的技术了,WebSocket协议为创建客户端和服务器端需要实时双向通讯的webapp提供了一个选择.其为HTML5的一部分,WebSocket相较于原来开发这类app的 ...

  2. 解决nginx转发websocket报400错误

    解决nginx转发websocket报400错误 说明 由于个人服务器上面有多个项目,配置了二级域名,需要对二级域名进行转发,在转发工作这快采取了大名鼎鼎的nginx.在这之前所有的项目运行转发都没问 ...

  3. Nginx 支持websocket的配置

    Nginx 支持websocket的配置server { listen 80; server_name 域名; location / { proxy_pass http://127.0.0.1:808 ...

  4. nginx支持websocket及websocket部分原理介绍

    nginx支持websocket及websocket部分原理介绍最近ipc通过websocket与server进行通行,经过无法通过nginx进行反向代理,只有直连nodejs端口.而且部署到阿里云用 ...

  5. nginx 代理 websocket

    nginx 代理 websocket nginx 首先确认版本必须是1.3以上 map指令的作用: 该作用主要是根据客户端请求中$http_upgrade 的值,来构造改变$connection_up ...

  6. Nginx支持WebSocket反向代理

    WebSocket是目前比较成熟的技术了,WebSocket协议为创建客户端和服务器端需要实时双向通讯的webapp提供了一个选择.其为HTML5的一部分,WebSocket相较于原来开发这类app的 ...

  7. nginx 支持websocket

    nginx 反向代理websocket nginx配置 请求地址及路径:ws://x.x.x.x/web/springws/websocket.ws 解析 map 指令 上面 nginx.conf 配 ...

  8. 使用nginx作为websocket的proxy server

    blog.csdn.net/zhx6044/article/details/50278765 WebSocket WebSocket协议为创建客户端和服务器端需要实时双向通讯的webapp提供了一个选 ...

  9. django + nginx + uwsgi + websocket

    最近使用django框架做了一个简单的聊天机器人demo, 开发的过程中使用了django自带的websocket模块,当使用django框架自带的wsgi服务去启动的话,没有什么问题.如果要使用uw ...

随机推荐

  1. 常用命令npm,gulp, node

    npm常用命令: 检查npm模块的安装情况:(以常用模块 grunt为例说明) 1) 检查是否全局安装了模块Grunt: $npm list -g grunt 2) 列出所有已经全局安装的模块:$np ...

  2. 权限管理demo-获取Spring上下文工具

    package com.mmall.common; import org.springframework.beans.BeansException; import org.springframewor ...

  3. xlrd 和xlwt 对Excel的操作

    xlrd与xlwt库的异同点对比 相同点 都支持对Excel文件格式为xls的文件进行操作 不同点 xlrd只支持对Excel文件格式为xls文件的读取 xlwt只支持对Excel文件格式为xls文件 ...

  4. 【Python】启动迅雷下载

    import subprocess import base64 thunder_path = 'E:\Thunder\Program\Thunder.exe' def Url2Thunder(url) ...

  5. leetcode337

    /** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...

  6. leetcode1030

    class Solution(object): def __init__(self): self.List = list() def bfs(self,R,C,S,V): T = list() whi ...

  7. STL里的内存池实现

    这个貌似有点复杂,解决的主要问题 就是 减少 内存分配次数,减少用户态核心态切换中断次数,提高运行速度,预分配 和线程池一个道理,预分配 ////////////////////自由链表 union ...

  8. ArcGIS自定义工具箱-显示地图文档结构

    ArcGIS自定义工具箱-显示地图文档结构 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 目的:显示地图文档mxd的数据组织结构,数据框,图层,表 使用方法: 地图 ...

  9. django + nginx + uwsgi

    server{ listen ; server_name 0.0.0.0; charset utf-; access_log /var/log/nginx/access.log main; locat ...

  10. trap实现跳板机

    第一节 跳板机实现原理(图例) 第2节 涉及到的知识点 命令:trap 拓展知识:进程与信号 trap 语法,作用,使用 [jeson@mage-jump-01 ~/]$  trap -l  1) S ...