nixos/dependency-track: fix nginx config for frontend
Apparend I fell for some browser cache when implementing this in the
first place. This patch is based on the upstream nginx config.
5f318aca10/docker/etc/nginx/templates/default.conf.template
This commit is contained in:
parent
e5a8e186e0
commit
4bc3f43923
@ -509,9 +509,27 @@ in
|
|||||||
upstreams.dependency-track.servers."localhost:${toString cfg.port}" = { };
|
upstreams.dependency-track.servers."localhost:${toString cfg.port}" = { };
|
||||||
virtualHosts.${cfg.nginx.domain} = {
|
virtualHosts.${cfg.nginx.domain} = {
|
||||||
locations = {
|
locations = {
|
||||||
"/".alias = "${cfg.package.frontend}/dist/";
|
"/" = {
|
||||||
|
alias = "${cfg.package.frontend}/dist/";
|
||||||
|
index = "index.html";
|
||||||
|
tryFiles = "$uri $uri/ /index.html";
|
||||||
|
extraConfig = ''
|
||||||
|
location ~ (index\.html)$ {
|
||||||
|
add_header Cache-Control "max-age=0, no-cache, no-store, must-revalidate";
|
||||||
|
add_header Pragma "no-cache";
|
||||||
|
add_header Expires 0;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
"/api".proxyPass = "http://dependency-track";
|
"/api".proxyPass = "http://dependency-track";
|
||||||
"= /static/config.json".alias = frontendConfigFile;
|
"= /static/config.json" = {
|
||||||
|
alias = frontendConfigFile;
|
||||||
|
extraConfig = ''
|
||||||
|
add_header Cache-Control "max-age=0, no-cache, no-store, must-revalidate";
|
||||||
|
add_header Pragma "no-cache";
|
||||||
|
add_header Expires 0;
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -45,7 +45,9 @@ import ./make-test-python.nix (
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript =
|
||||||
|
# python
|
||||||
|
''
|
||||||
import json
|
import json
|
||||||
|
|
||||||
start_all()
|
start_all()
|
||||||
@ -61,6 +63,9 @@ import ./make-test-python.nix (
|
|||||||
server.succeed("curl http://localhost/api/version")
|
server.succeed("curl http://localhost/api/version")
|
||||||
)
|
)
|
||||||
assert version["version"] == "${pkgs.dependency-track.version}"
|
assert version["version"] == "${pkgs.dependency-track.version}"
|
||||||
|
|
||||||
|
with subtest("nginx serves frontend"):
|
||||||
|
server.succeed("curl http://localhost/ | grep \"<title>Dependency-Track</title>\"")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user