Use osapi_glance_link_prefix for image location header

When an image is created the location header returned is generated based
on the request url that nova-api receives.  If SSL termination happens
upstream the request url is an http request, and the location header is
wrongly generated with that.  The osapi_glance_link_prefix config option
is available for almost precisely this purpose, so let's use it.

Change-Id: I24e46ed8fc0763f9ddeec65e0d79590dd7b86bef
Closes-bug: 1298005
This commit is contained in:
Andrew Laski
2014-03-26 15:11:18 -04:00
parent ec4d88c298
commit 42edf020e2
2 changed files with 17 additions and 1 deletions

View File

@@ -1466,7 +1466,9 @@ class Controller(wsgi.Controller):
# build location of newly-created image entity
image_id = str(image['id'])
image_ref = os.path.join(req.application_url,
url_prefix = self._view_builder._update_glance_link_prefix(
req.application_url)
image_ref = os.path.join(url_prefix,
context.project_id,
'images',
image_id)