1bf215546Sopenharmony_ciproxy_cache_path /var/cache/nginx/ levels=1:2 keys_zone=my_cache:10m max_size=24g inactive=48h use_temp_path=off;
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ciserver {
4bf215546Sopenharmony_ci	listen 10.42.0.1:8888 default_server;
5bf215546Sopenharmony_ci	listen 127.0.0.1:8888 default_server;
6bf215546Sopenharmony_ci	listen [::]:8888 default_server;
7bf215546Sopenharmony_ci	resolver 8.8.8.8;
8bf215546Sopenharmony_ci
9bf215546Sopenharmony_ci	root /var/www/html;
10bf215546Sopenharmony_ci
11bf215546Sopenharmony_ci	# Add index.php to the list if you are using PHP
12bf215546Sopenharmony_ci	index index.html index.htm index.nginx-debian.html;
13bf215546Sopenharmony_ci
14bf215546Sopenharmony_ci	server_name _;
15bf215546Sopenharmony_ci
16bf215546Sopenharmony_ci        add_header X-GG-Cache-Status $upstream_cache_status;
17bf215546Sopenharmony_ci        proxy_cache my_cache;
18bf215546Sopenharmony_ci
19bf215546Sopenharmony_ci        location /cache_gitlab_artifacts {
20bf215546Sopenharmony_ci                internal;
21bf215546Sopenharmony_ci                # Gitlabs http server puts everything as no-cache even though
22bf215546Sopenharmony_ci                # the artifacts URLS don't change. So enforce a long validity
23bf215546Sopenharmony_ci                # time and ignore the headers that defeat caching
24bf215546Sopenharmony_ci                proxy_cache_valid 200 48h;
25bf215546Sopenharmony_ci                proxy_ignore_headers Cache-Control Set-Cookie;
26bf215546Sopenharmony_ci                include snippets/uri-caching.conf;
27bf215546Sopenharmony_ci        }
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci        location /cache {
30bf215546Sopenharmony_ci                # special case gitlab artifacts
31bf215546Sopenharmony_ci                if ($arg_uri ~*  /.*gitlab.*artifacts(\/|%2F)raw/ ) {
32bf215546Sopenharmony_ci                        rewrite ^ /cache_gitlab_artifacts;
33bf215546Sopenharmony_ci                }
34bf215546Sopenharmony_ci                # Set a really low validity together with cache revalidation; Our goal
35bf215546Sopenharmony_ci                # for caching isn't to lower the number of http requests but to
36bf215546Sopenharmony_ci                # lower the amount of data transfer. Also for some test
37bf215546Sopenharmony_ci                # scenarios (typical manual tests) the file at a given url
38bf215546Sopenharmony_ci                # might get modified so avoid confusion by ensuring
39bf215546Sopenharmony_ci                # revalidations happens often.
40bf215546Sopenharmony_ci                proxy_cache_valid 200 10s;
41bf215546Sopenharmony_ci                proxy_cache_revalidate on;
42bf215546Sopenharmony_ci                include snippets/uri-caching.conf;
43bf215546Sopenharmony_ci        }
44bf215546Sopenharmony_ci}
45