Mesa (main): docs/ci: Update http cache config to let Authorization headers pass through

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 28 14:16:56 UTC 2021


Module: Mesa
Branch: main
Commit: 8d8a91617d1756e386a0cab082165cd08b666ae7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d8a91617d1756e386a0cab082165cd08b666ae7

Author: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Date:   Wed Apr 14 15:16:14 2021 +0200

docs/ci: Update http cache config to let Authorization headers pass through

When downloading traces from a restricted repository, the Authorization
header will be set. Previous to this change, the http proxy would drop
it.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6441>

---

 docs/ci/uri-caching.conf | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/docs/ci/uri-caching.conf b/docs/ci/uri-caching.conf
index c360c55c33a..249998bf883 100644
--- a/docs/ci/uri-caching.conf
+++ b/docs/ci/uri-caching.conf
@@ -1,4 +1,4 @@
-set $authorization '';
+set $proxy_authorization '';
 
 set_by_lua $proxyuri '
         unescaped =  ngx.unescape_uri(ngx.var.arg_uri);
@@ -13,10 +13,12 @@ set_by_lua $proxyuri '
         host = it[3];
         query = it[4];
 
-        if authstring then
+        if ngx.var.http_authorization and ngx.var.http_authorization ~= "" then
+                ngx.var.proxy_authorization = ngx.var.http_authorization;
+        elseif authstring then
                 auth = string.sub(authstring, 0, -2);
                 auth64 = ngx.encode_base64(auth);
-                ngx.var.authorization = "Basic " .. auth64;
+                ngx.var.proxy_authorization = "Basic " .. auth64;
         end
 
         -- Default to / if none is set to avoid using the request_uri query
@@ -28,7 +30,7 @@ set_by_lua $proxyuri '
 ';
 
 add_header X-GG-Cache-Status $upstream_cache_status;
-proxy_set_header Authorization $authorization;
+proxy_set_header Authorization $proxy_authorization;
 
 proxy_pass $proxyuri;
 # Redirect back to ourselves on 301 replies



More information about the mesa-commit mailing list