-set $authorization '';
+set $proxy_authorization '';
set_by_lua $proxyuri '
unescaped = ngx.unescape_uri(ngx.var.arg_uri);
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
';
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