Containers/Swift URL Redirection Loop

Bug #1597528 reported by Diana Whitten
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Richard Jones

Bug Description

If you hit /project/containers/container/ directly, you hit an infinite reloading loop.

See the captured animated gif attached.

Revision history for this message
Diana Whitten (hurgleburgler) wrote :
Changed in horizon:
status: New → Confirmed
Revision history for this message
Travis Tripp (travis-tripp) wrote :

For the above running under devstack dashboard webroot, i see the following:

http://<>/dashboard/project/containers/container/

flashes briefly
I get redirected to http://<>/project/containers/container/

With a 404 error.

This seems to happen for all django routed detail pages. Other examples:

/dashboard/project/networks/<ID>/detail

Changed in horizon:
importance: Undecided → High
Changed in horizon:
milestone: none → newton-2
Revision history for this message
Itxaka Serrano (itxaka) wrote :

Can reproduce the container part but not in other detail pages, in those I get a 404.

This seems to be an issue between the "real" url and the url that we manage on the ContainersController

If you access project/containers you can see that the containerRoute attribute in the ContainersController is "project/containers/container/" so the angular route seems to catch up and try to redirect, entering an infinite loop:

Location change from http://localhost:8000/project/containers/container/ to http://localhost:8000/project/containers/container/

Checked this by adding the following to debug the route in case someone with more experience in angular wants to try to fix this:

--- a/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js
@@ -27,7 +27,21 @@
    */
   angular
     .module('horizon.dashboard.project.containers', ['ngRoute'])
- .config(config);
+ .config(config)
+ .run([
+ '$rootScope',
+ function($rootScope) {
+ $rootScope.$on('$routeChangeStart', function(event, next, current) {
+ var currentPath = current.originalPath;
+ var nextPath = next.originalPath;
+ console.log('Route change from %s to %s', currentPath, nextPath);
+ });
+ $rootScope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {
+ // this is for redirects
+ console.log('Location change from %s to %s', oldUrl, newUrl);
+ });
+ }
+ ]);

   config.$inject = [
     '$provide',

Revision history for this message
Matt Borland (palecrow) wrote :

There are two separate issues here, let's not conflate them.

1) The original bug: containers doesn't route properly due to some confusion in the path.
2) Routing from Angular pages in a webroot context to non-Angular pages can cause bad redirect.

I will put a patch up for (2), separate from this bug report.

Revision history for this message
Matt Borland (palecrow) wrote :

FYI I believe the answer to (1) is due to

url(r'^container/((?P<container_name>.+?)/)?'

in containers' urls.py...this matches things oddly I believe when you have a container named 'container.'

Revision history for this message
Matt Borland (palecrow) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/336363

Changed in horizon:
assignee: nobody → Richard Jones (r1chardj0n3s)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/336363
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=399968528850814b7415a7cef9d031f4eb73ad6e
Submitter: Jenkins
Branch: master

commit 399968528850814b7415a7cef9d031f4eb73ad6e
Author: Richard Jones <email address hidden>
Date: Fri Jul 1 14:25:47 2016 +1000

    Fix constant redirect on missing container name

    The routing rules were missing a handler for the absence
    of the container name in the /project/containers/container/
    URL form. This caused AngularJS to issue a redirect when
    the container name is empty.

    Change-Id: I053934917ecfaa10dc8d760cc3a0d02249977031
    Closes-Bug: 1597528

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/horizon 10.0.0.0b2

This issue was fixed in the openstack/horizon 10.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.