You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Quasar应用Cloudflared Tunnel环境下WebSocket热重载配置问题

问题:Quasar通过Cloudflared Tunnel实现WebSocket热重载连接失败

我给Quasar应用配置了一条Cloudflared Tunnel,同时另一条隧道用于前端与Ruby on Rails后端的通信。目前两者的常规通信已经配置完成,但热重载功能所需的WebSocket连接始终无法正常工作。

现有Quasar配置文件

env: {
        API: ctx.dev
          ? 'https://example.com/api'
          : 'http://example.com/api/'
      }
    },

    // Full list of options: https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer
    devServer: {
      https: false,
      port: 3000,
      open: true, // opens browser window automatically
      proxy: {
        // proxy all requests starting with /api to your API
        '/api': {
          target: ctx.dev
            ? 'https://example.com/'
            : 'http://example.com/api/',
          changeOrigin: true,
          pathRewrite: {
            '^/api': '/api/v1'
          }
        }
      }
    },

已尝试的WebSocket代理配置(未解决问题)

'/ws': {
          target: ctx.dev
            ? 'https://example.com:3000/' // 这里填的是Cloudflared给前端生成的URL
            : 'http://example.com/api/', // 目前不影响
          ws: true,
          changeOrigin: true
        }

内容的提问来源于stack exchange,提问作者carlos eduardo rodrguez huerta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 08:05:01