ChooseVersion prefers exact URL matches now.
diff --git a/openstack/utils/choose_version.go b/openstack/utils/choose_version.go
index 7604f75..088e086 100644
--- a/openstack/utils/choose_version.go
+++ b/openstack/utils/choose_version.go
@@ -2,6 +2,7 @@
 
 import (
 	"fmt"
+	"net/url"
 	"strings"
 
 	"github.com/racker/perigee"
@@ -22,7 +23,7 @@
 // ChooseVersion queries the base endpoint of a API to choose the most recent non-experimental alternative from a service's
 // published versions.
 // It returns the highest-Priority Version among the alternatives that are provided, as well as its corresponding endpoint.
-func ChooseVersion(baseEndpoint string, recognized []*Version) (*Version, string, error) {
+func ChooseVersion(identityEndpoint string, recognized []*Version) (*Version, string, error) {
 	type linkResp struct {
 		Href string `json:"href"`
 		Rel  string `json:"rel"`
@@ -42,8 +43,16 @@
 		Versions versionsResp `json:"versions"`
 	}
 
+	// Normalize the identity endpoint that's provided by trimming any path, query or fragment from the URL.
+	u, err := url.Parse(identityEndpoint)
+	if err != nil {
+		return nil, "", err
+	}
+	u.Path, u.RawQuery, u.Fragment = "", "", ""
+	normalized := u.String()
+
 	var resp response
-	_, err := perigee.Request("GET", baseEndpoint, perigee.Options{
+	_, err = perigee.Request("GET", normalized, perigee.Options{
 		Results: &resp,
 		OkCodes: []int{200, 300},
 	})
@@ -61,27 +70,37 @@
 	var endpoint string
 
 	for _, value := range resp.Versions.Values {
-		if matching, ok := byID[value.ID]; ok && goodStatus[strings.ToLower(value.Status)] {
-			if highest == nil || matching.Priority > highest.Priority {
-				highest = matching
+		href := ""
+		for _, link := range value.Links {
+			if link.Rel == "self" {
+				href = link.Href
+			}
+		}
 
-				found := false
-				for _, link := range value.Links {
-					if link.Rel == "self" {
-						found = true
-						endpoint = link.Href
-					}
+		if matching, ok := byID[value.ID]; ok {
+			// Prefer a version that exactly matches the provided endpoint.
+			if href == identityEndpoint {
+				if href == "" {
+					return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", value.ID, normalized)
 				}
+				return matching, href, nil
+			}
 
-				if !found {
-					return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", value.ID, baseEndpoint)
+			// Otherwise, find the highest-priority version with a whitelisted status.
+			if goodStatus[strings.ToLower(value.Status)] {
+				if highest == nil || matching.Priority > highest.Priority {
+					highest = matching
+					endpoint = href
 				}
 			}
 		}
 	}
 
-	if highest == nil || endpoint == "" {
-		return nil, "", fmt.Errorf("No supported version available from endpoint %s", baseEndpoint)
+	if highest == nil {
+		return nil, "", fmt.Errorf("No supported version available from endpoint %s", normalized)
+	}
+	if endpoint == "" {
+		return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", highest.ID, normalized)
 	}
 
 	return highest, endpoint, nil