Comment 1 for bug 1993618

Revision history for this message
Samuel Allan (samuelallan) wrote : Re: web ui redirects invalid behind haproxy

It appears that the problem comes from these redirects in regiond.nginx.conf:

```

    location = / {
        return 301 /MAAS/r/;
    }

    location ~ ^/MAAS/?$ {
        return 301 /MAAS/r/;
    }
```

A potential fix could be to turn off absolute redirects, so that redirects will be automatically interpreted in the context of the requesting url:

```
diff --git a/src/maasserver/templates/http/regiond.nginx.conf.template b/src/maasserver/templates/http/regiond.nginx.conf.template
index b45a7fff9..d9593ccc9 100644
--- a/src/maasserver/templates/http/regiond.nginx.conf.template
+++ b/src/maasserver/templates/http/regiond.nginx.conf.template
@@ -30,6 +30,9 @@ server {
     listen {{http_port}};
     {{endif}}

+ absolute_redirect off;
+ port_in_redirect off;
+
     location = / {
         return 301 /MAAS/r/;
     }
```