aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Casagrande <milo.casagrande@linaro.org>2015-04-28 10:00:01 +0200
committerMilo Casagrande <milo.casagrande@linaro.org>2015-04-28 10:00:01 +0200
commit96756e449e94c23211a70555c4405346eb8ec6b3 (patch)
tree6cc6af96312f20bbf157c6cb90b6808f04c4272c
parent5197c752e79c94055b3b7d4d6ba08b763298a4f5 (diff)
ansible: Fix nginx config for query redirect.boot-id-urls
* Take the _id query parameter and transform it into a URL.
-rw-r--r--ansible/roles/configure-nginx/templates/kernelci-frontend.conf20
1 files changed, 20 insertions, 0 deletions
diff --git a/ansible/roles/configure-nginx/templates/kernelci-frontend.conf b/ansible/roles/configure-nginx/templates/kernelci-frontend.conf
index b219b45..78251f5 100644
--- a/ansible/roles/configure-nginx/templates/kernelci-frontend.conf
+++ b/ansible/roles/configure-nginx/templates/kernelci-frontend.conf
@@ -20,6 +20,26 @@ server {
return 503;
}
+ # Check if /boot URLs have the _id query parameter.
+ # nginx does not support nested if nor AND/OR if clauses.
+ # Where to store the _id value.
+ set $oid "";
+ # Control variable.
+ set $burl "";
+
+ if ($request_uri ~ "^/boot/(.*)$") {
+ set $burl "b";
+ }
+
+ if ($args ~ "^_id=(.*)") {
+ set $oid $1;
+ set $burl "${burl}a";
+ }
+
+ if ($burl = "ba") {
+ return 301 $uri/$oid?;
+ }
+
include uwsgi_params;
uwsgi_modifier1 30;
uwsgi_pass frontends;