Flask-scoket.io+Vue-scoket.io+nginx+gunicorn部署问题

Flask-scoket.io+Vue-scoket.io+nginx+gunicorn部署问题

一直报 400(bad request)错误 谢谢各位大佬!!我给买奶茶qaq

vue main.js代码

Vue.use(new VueSocketIO({
  debug: true,
  // 服务器端地址
  connection: '/a/text',
  


 }))

Vue.config.js代码

'/a': {
        target: 'http://59.110.69.160:8070',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/a': ''
        }

nginx.conf部署代码

server {
        listen       8070 default_server;
        listen       [::]:8070 default_server;  
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location /socket.io {/这里 加上 ^~ 重写的化也是400
        proxy_pass http://127.0.0.1:5010;这里尝试着用/scoket.io都没有用
        proxy_redirect off;
        proxy_buffering off;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        add_header Access-Control-Allow-Origin *;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";

    }
    }

gunicorn启动

gunicorn -k gevent -w 5 -b 127.0.0.1:5010 socket:app
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值