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}" = { };
|
||||
virtualHosts.${cfg.nginx.domain} = {
|
||||
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";
|
||||
"= /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,22 +45,27 @@ import ./make-test-python.nix (
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
import json
|
||||
testScript =
|
||||
# python
|
||||
''
|
||||
import json
|
||||
|
||||
start_all()
|
||||
start_all()
|
||||
|
||||
server.wait_for_unit("dependency-track.service")
|
||||
server.wait_until_succeeds(
|
||||
"journalctl -o cat -u dependency-track.service | grep 'Dependency-Track is ready'"
|
||||
)
|
||||
server.wait_for_open_port(${toString dependencyTrackPort})
|
||||
|
||||
with subtest("version api returns correct version"):
|
||||
version = json.loads(
|
||||
server.succeed("curl http://localhost/api/version")
|
||||
server.wait_for_unit("dependency-track.service")
|
||||
server.wait_until_succeeds(
|
||||
"journalctl -o cat -u dependency-track.service | grep 'Dependency-Track is ready'"
|
||||
)
|
||||
assert version["version"] == "${pkgs.dependency-track.version}"
|
||||
'';
|
||||
server.wait_for_open_port(${toString dependencyTrackPort})
|
||||
|
||||
with subtest("version api returns correct version"):
|
||||
version = json.loads(
|
||||
server.succeed("curl http://localhost/api/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