Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/docs/ci/uri-caching.conf
4558 views
1
set $authorization '';
2
3
set_by_lua $proxyuri '
4
unescaped = ngx.unescape_uri(ngx.var.arg_uri);
5
it, err = ngx.re.match(unescaped, "(https?://)(.*@)?([^/]*)(/.*)?");
6
if not it then
7
-- Hack to cause nginx to return 404
8
return "http://localhost/404"
9
end
10
11
scheme = it[1];
12
authstring = it[2];
13
host = it[3];
14
query = it[4];
15
16
if authstring then
17
auth = string.sub(authstring, 0, -2);
18
auth64 = ngx.encode_base64(auth);
19
ngx.var.authorization = "Basic " .. auth64;
20
end
21
22
-- Default to / if none is set to avoid using the request_uri query
23
if not query then
24
query = "/";
25
end
26
27
return scheme .. host .. query;
28
';
29
30
add_header X-GG-Cache-Status $upstream_cache_status;
31
proxy_set_header Authorization $authorization;
32
33
proxy_pass $proxyuri;
34
# Redirect back to ourselves on 301 replies
35
proxy_redirect ~^(.*)$ /cache/?uri=$1;
36
37