Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
1.7.1
-
None
Description
Rackspace allows users to set custom HTTP Headers on their files that are being served. This is especially useful for web fonts, as some browsers refuse to use the fonts unless the following header is set (more info here):
Access-Control-Allow-Origin: *
Upon getting a SwiftObject from my Rackspace CloudFilesClient object and calling getAllHeaders().put( "Access-Control-Allow-Origin", "*" ) I could see that the header was being lost and not sent with the underlying HTTP request.
As a workaround here I patched org.jclouds.openstack.swift.binders.BindSwiftObjectMetadataToRequest. Instead of simply binding the blob to the request and returning it (lines 86 + 87), I changed it to bind the blob, then added all headers from the blob to the request.
Blob blob = object2Blob.apply( object ); request = mdBinder.bindToRequest( request, blob ); return ( R ) request.toBuilder().replaceHeaders( blob.getAllHeaders() ).build();