首页 > 解决方案 > 拦截 websocket 并使用 NGINX 附加一个新令牌

问题描述

在我做这个代理之前

location /ws/streams/ {
  rewrite \/ws\/streams\/(\d+) /streams/$1?token=TOKEN break;
  proxy_pass https://www.stream.com;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
}

但现在我需要令牌是动态的(它每小时到期)

我需要以某种方式获取该令牌并将其附加到该 TOKEN 变量中。这个新令牌是通过使用 'application/x-www-form-urlencoded' 作为 'Content-Type' 的 POST 请求来请求的

如果有人可以帮助我,我将不胜感激

提前致谢

标签: dockernginxproxy

解决方案


推荐阅读