Apache-2.2

如何在 Apache HTTP Server 中使用另一個標頭的值添加標頭

  • March 7, 2018

我的 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>

我錯過了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>

引用自:https://serverfault.com/questions/900481