环境

  • alpine 3.16

V2ray

  • 安装

    #安装
    apk add v2ray

    #开机启动
    rc-update add v2ray

    #启动
    rc-service v2ray
  • 配置/etc/v2ray/config.json

    {
    "inbounds": [
    {
    "port": 80,
    "listen":"::",
    "protocol": "vmess",
    "settings": {
    "clients": [
    {
    "id": "#自己生成uuid",
    "alterId": 0
    }
    ]
    },
    "streamSettings": {
    "network": "ws",
    "wsSettings": {
    "path": "#自己填写路径"
    }
    }
    }
    ],
    "outbounds": [
    {
    "protocol": "freedom",
    "settings": {}
    }
    ]
    }

Cloudflare配置

  1. 首页->Workers->Create a Service
  2. 选择Http handlerService Worker Syntax
  3. 右上角Quick edit
    addEventListener(
    'fetch',event => {
    let url=new URL(event.request.url);
    url.hostname='#自己的域名,如xxx.baidu.com';
    if(url.protocol == 'https:') {
    url.protocol='http:'
    }
    let request=new Request(url,event.request);
    if(request.headers.has("Origin")) {
    request.headers.delete("Origin");
    }
    event.respondWith(
    fetch(request)
    )
    }
    )
  4. 域名管理页面Workers Routes
  5. Route填写域名,如xxx.baidu.com/*
  6. Service选择你创建的Workers Service

参考