gpt4 book ai didi

authorization - 在 Varnish 中取消设置授权 header ,但也将 header 发送到后端

转载 作者:行者123 更新时间:2023-12-03 17:46:00 26 4
gpt4 key购买 nike

我想删除varnish vcl中的Authorization header ,但也需要将此 header 也发送到后端。

sub vcl_recv {
unset req.http.Authorization;
}

最佳答案

看来这是一个坏主意,但是使用一些基本的VCL绝对可以实现。例如:

sub vcl_recv {
if (req.http.Authorization) {
set req.http.Authorization-Copy = req.http.Authorization;
unset req.http.Authorization;
} else {
unset set req.http.Authorization-Copy;
}
}

sub vcl_backend_fetch {
if (bereq.http.Authorization-Copy) {
set bereq.http.Authorization = bereq.http.Authorization-Copy;
unset bereq.http.Authorization-Copy;
}
}

关于authorization - 在 Varnish 中取消设置授权 header ,但也将 header 发送到后端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54555004/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com