我能够从 URL 中获取令牌,但之后我想在下一个 URL 的末尾返回它。例如,我有这样的 URL:
http://localhost:8900/dashboards?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
我想获取令牌并将其添加到下一个请求的末尾。例如:
http://localhost:8900/home?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
等等...
我被这个问题困扰了一段时间,如果能得到任何帮助我都会很感激。提前谢谢您!
这是我目前的代码:
location / {
set $token $arg_token;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
proxy_set_header X-WEBAUTH-USER $remote_user;
proxy_set_header X-User-custom $token;
proxy_pass http://localhost:3000;
}