我的 Apache 服务器正在代理一个请求,该请求中会收到一个标头 (oidc_access_token)。如何在转发的请求中添加另一个标头 Authorization,其值包含前缀 (Bearer) 和 oidc_access_token 标头的值?
我尝试了这个但是没有用:
<Location "/person-service" >
RequestHeader set Authorization "Bearer %{oidc_access_token}"
ProxyPass http://app1:9292/person-service
ProxyPassreverse http://app1:9292/person-service
</Location>
答案1
我缺少e
将传入标头作为环境变量引用的功能:
<Location "/person-service" >
RequestHeader set Authorization "Bearer %{oidc_access_token}e"
ProxyPass http://app1:9292/person-service
ProxyPassreverse http://app1:9292/person-service
</Location>