rackspace / php-opencloud

The PHP SDK for OpenStack clouds
developer.rackspace.com
Other
451 stars 250 forks source link

Access-Control-Allow-Origin not working with get getTemporaryUrl #741

Closed loicmitton closed 4 years ago

loicmitton commented 4 years ago

Hello,

I'm trying to create a php script that will be called from javascript to get a temp url to upload file.

I have this code :

$container->saveMetadata(array( 'Access-Control-Allow-Origin' => '', 'X-Container-Meta-Access-Control-Allow-Origin' => '' )); $filename = com_create_guid(); //echo $filename; $object = $container->dataObject(); $object ->saveMetadata(array( 'Access-Control-Allow-Origin' => '*', 'Access-Control-Expose-Headers' => 'Access-Control-Allow-Origin' )); $object->setName($filename); //probably a GUID $url = $object->getTemporaryUrl(3000, "PUT");

However if I try to call the temporary url to upload the file, I get a 401 response code and OPTION on the temp url don't display the access-control-allow-origin.

loicmitton commented 4 years ago

Container header was wrongly set.