Skip to content

Instantly share code, notes, and snippets.

@techotaku
Last active August 5, 2023 22:32
Show Gist options
  • Save techotaku/4ea5da47baa542eb5da244b2be8590d9 to your computer and use it in GitHub Desktop.
Save techotaku/4ea5da47baa542eb5da244b2be8590d9 to your computer and use it in GitHub Desktop.
HAProxy to Nginx (Web + V2Ray WebSocket) + OpenConnect + SSH + ShadowsocksR (TLS OBFS)
defaults
timeout connect 5s
timeout client 24h
timeout server 24h
global
log /dev/log local0
frontend ssl
log global
mode tcp
option tcplog
option dontlognull
bind 0.0.0.0:443
tcp-request inspect-delay 3s
tcp-request content accept if { req.ssl_hello_type 1 }
acl tls req.ssl_hello_type 1
acl has_sni req.ssl_sni -m found
acl ssh_payload payload(0,7) -m bin 5353482d322e30
use_backend ocserv if tls !has_sni
use_backend shadowsocksr if tls { req.ssl_sni -i your.tls.obfuscation.domain }
use_backend nginx if tls has_sni
use_backend openssh if ssh_payload
use_backend openssh if !tls { req.len 0 }
default_backend nginx
backend openssh
mode tcp
timeout server 3h
server openssh your.host.internal.ip:22
backend ocserv
mode tcp
server sslvpn ocserv:443 send-proxy-v2
backend nginx
mode tcp
timeout server 5m
server webserver nginx:443 send-proxy
backend shadowsocksr
mode tcp
server socks ssr:443
@techotaku
Copy link
Author

How to enable proxy-protocol on:

@iTmAn82
Copy link

iTmAn82 commented Aug 13, 2018

你好,我按照你的配置haproxy反代nginx,nginx再反代v2ray,网站和可以正常访问,v2ray可以正常接收到客户端的请求数据,但是服务器会错:[Warning] Transport|Internet|WebSocket: failed to serve http for WebSocket > accept tcp 本地ip:端口: use of closed network connection,请问是不是nginx还需要配置什么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment