Skip to content

Instantly share code, notes, and snippets.

@ihciah
Last active January 18, 2023 19:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ihciah/eddd2c4bc381a3dfefac7ac85e8aab09 to your computer and use it in GitHub Desktop.
Save ihciah/eddd2c4bc381a3dfefac7ac85e8aab09 to your computer and use it in GitHub Desktop.
V2ray with cloudflare websocket

Configure v2ray with cloudflare with docker and docker-compose

  • caddy-*: http server related files
  • v2ray-*: v2ray related files
  • forword-*: files to relay requests
cf.domain.com {
tls ihciah@gmail.com
tls {
dns cloudflare aaaaaaaa
}
reverse_proxy /path localhost:10086 {
header_up -Origin
}
}
original.domain.com {
tls ihciah@gmail.com
tls {
dns cloudflare aaaaaaaa
}
root * /var/www/html
file_server
}
version: '2.4'
services:
caddy:
image: ihciah/caddy:latest
container_name: caddy
restart: always
network_mode: "host"
volumes:
- type: "bind"
source: "./Caddyfile"
target: "/etc/caddy/Caddyfile"
- "./data:/data/caddy"
- "./html:/var/www/html:ro"
FROM caddy:2.1.1-builder AS builder
RUN caddy-builder \
github.com/caddy-dns/cloudflare
FROM caddy:2.1.1
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
domain2.com:4431 {
tls ihciah@gmail.com
tls {
dns cloudflare aaaaaaaaa
}
reverse_proxy /path https://domain.com:443 {
header_up Host domain.com
header_up -Origin
}
}
{
"inbounds": [{
"port": 10086,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"level": 1,
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/path"
}
}
}],
"outbounds": [{
"protocol": "freedom",
"settings": {}
},{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}],
"routing": {
"rules": [
{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "blocked"
}
]
}
}
version: '2.4'
services:
v2ray:
image: v2ray/official:latest
container_name: v2ray
restart: always
network_mode: "host"
volumes:
- type: "bind"
source: "./config.json"
target: "/etc/v2ray/config.json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment