From ef5126de1dc3366438ef6027521161284dca893a Mon Sep 17 00:00:00 2001
From: Nikolay Stanchev <ns17@it-innovation.soton.ac.uk>
Date: Wed, 28 Nov 2018 11:51:33 +0000
Subject: [PATCH] Fixes redirect issues with the CLMC nginx.conf

---
 scripts/clmc-service/nginx.conf | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/clmc-service/nginx.conf b/scripts/clmc-service/nginx.conf
index 2c4029e..f0f4dda 100644
--- a/scripts/clmc-service/nginx.conf
+++ b/scripts/clmc-service/nginx.conf
@@ -31,6 +31,9 @@ http {
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header X-Forwarded-Host $server_name;
         }
+        location /clmc-service {
+            rewrite /clmc-service $scheme://$http_host/clmc-service/ redirect;
+        }
         location /clmc-service/ {
             proxy_pass http://127.0.0.1:9080/;
             proxy_redirect off;
@@ -39,6 +42,9 @@ http {
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header X-Forwarded-Host $server_name;
         }
+        location /influxdb {
+            rewrite /influxdb $scheme://$http_host/influxdb/ redirect;
+        }
         location /influxdb/ {
             proxy_pass http://127.0.0.1:8086/;
             proxy_redirect off;
@@ -47,9 +53,12 @@ http {
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header X-Forwarded-Host $server_name;
         }
+        location /neo4j {
+            rewrite /neo4j $scheme://$http_host/neo4j/ redirect;
+        }
         location /neo4j/ {
             proxy_pass http://127.0.0.1:7474/;
-            proxy_redirect off;
+            proxy_redirect $scheme://$http_host/ $scheme://$http_host/neo4j/;  # in case a redirect is returned from server
             proxy_set_header Host $http_host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-- 
GitLab