[Kimchi-devel] [PATCH] bug fix: Redirect 3xx responses through proxy

Aline Manera alinefm at linux.vnet.ibm.com
Wed Apr 30 00:51:31 UTC 2014


From: Aline Manera <alinefm at br.ibm.com>

When there is an redirection after POST/PUT/DELETE method, the proxy
must receive the response and redirect it properly to the correct server
and port.

The problem was identified when trying to rename a VM or template, or
even while cloning a template.

Fix it by adding new rules to nginx proxy configuration.

Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
 src/kimchi/config.py.in |    1 +
 src/nginx.conf.in       |    4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
index da89e3a..ac1667e 100644
--- a/src/kimchi/config.py.in
+++ b/src/kimchi/config.py.in
@@ -170,6 +170,7 @@ class KimchiConfig(dict):
         '/': {'tools.trailing_slash.on': False,
               'request.methods_with_bodies': ('POST', 'PUT'),
               'tools.nocache.on': True,
+              'tools.proxy.on': True,
               'tools.sessions.on': True,
               'tools.sessions.name': 'kimchi',
               'tools.sessions.secure': True,
diff --git a/src/nginx.conf.in b/src/nginx.conf.in
index f077fef..c339e56 100644
--- a/src/nginx.conf.in
+++ b/src/nginx.conf.in
@@ -50,10 +50,12 @@ http {
         add_header X-XSS-Protection "1; mode=block";
 
         location / {
-            proxy_pass http://localhost:$kimchid_port;
+            proxy_pass http://127.0.0.1:$kimchid_port;
             proxy_set_header Host $host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_redirect http://127.0.0.1:$kimchid_port/ https://$host:$proxy_ssl_port/;
+
         }
     }
 
-- 
1.7.10.4




More information about the Kimchi-devel mailing list