Fix CORS in rackspace in upload-logs-swift
The CDN setup that rackspace has requires that the Access-Control-Allow-Origin header be added to each object uploaded. Change-Id: I0f6af613e2ebcf9cfe835dc8018a73922f9f0ed5
This commit is contained in:
parent
41d06378b0
commit
4a1ecf50a5
@ -497,10 +497,13 @@ class Uploader():
|
|||||||
# The ceph radosgw swift implementation requires an
|
# The ceph radosgw swift implementation requires an
|
||||||
# index.html at the root in order for any other indexes to
|
# index.html at the root in order for any other indexes to
|
||||||
# work.
|
# work.
|
||||||
|
index_headers = {'access-control-allow-origin': '*'}
|
||||||
self.cloud.create_object(self.container,
|
self.cloud.create_object(self.container,
|
||||||
name='index.html',
|
name='index.html',
|
||||||
data='',
|
data='',
|
||||||
content_type='text/html')
|
content_type='text/html',
|
||||||
|
**index_headers)
|
||||||
|
|
||||||
# Enable the CDN in rax
|
# Enable the CDN in rax
|
||||||
if cdn_url:
|
if cdn_url:
|
||||||
self.cloud.session.put(cdn_url)
|
self.cloud.session.put(cdn_url)
|
||||||
@ -574,6 +577,8 @@ class Uploader():
|
|||||||
if self.delete_after:
|
if self.delete_after:
|
||||||
headers['x-delete-after'] = str(self.delete_after)
|
headers['x-delete-after'] = str(self.delete_after)
|
||||||
headers['content-type'] = file_detail.mimetype
|
headers['content-type'] = file_detail.mimetype
|
||||||
|
# This is required for Rackspace CDN
|
||||||
|
headers['access-control-allow-origin'] = '*'
|
||||||
|
|
||||||
for attempt in range(1, POST_ATTEMPTS + 1):
|
for attempt in range(1, POST_ATTEMPTS + 1):
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user