how can I see the full URL of files saved in Swift?

asked 2015-04-19 20:20:16 -0600

akhildev gravatar image

updated 2015-04-21 10:23:10 -0600

smaffulli gravatar image

I am planning to use openstack-swift as an image repository. My use case includes a. uploading images using the http form upload. b. Previewing of the uploaded images.

I am looking for a way by which i can give a direct URL to the uploaded image so that the browser can render it.

edit retag flag offensive close merge delete

3 answers

Sort by ┬╗ oldest newest most voted
0

answered 2015-04-20 18:34:18 -0600

torgomatic gravatar image

You can use Swift's tempurl feature for this: http://docs.openstack.org/trunk/confi...

Basically, you hash together the object name, link expiration time, verb (here, "GET"), and an account-level secret and then stick that in a query parameter. That link allows public access until the expiration time.

Hint: If you want a link that's good for basically forever, just make the expiration time really large.

edit flag offensive delete link more
0

answered 2015-04-21 09:21:55 -0600

I would recommend using a Temp URL as to not expose the direct location of the image if this was going to be external facing. If you do expose the URL then your container you may want to look into securing your container with Swift ACL's. Also ensure the content-type is correct and you should be able to just use the full URL to the object in the tag.

http://docs.openstack.org/trunk/confi... http://docs.openstack.org/developer/s...

edit flag offensive delete link more
0

answered 2015-04-20 04:47:28 -0600

uts9 gravatar image

updated 2015-04-20 11:01:58 -0600

smaffulli gravatar image

Create a container and upload your images. While uploading the file you need to specify a name(objname).

URL will be in below format

 http://api.yourswifthost.net:8080/v1/AUTH_ABCD/containername/objname

However in AWS, you can directly access the files by specifying the bucketname.

 https://<location>.amazonaws.com/<bucketname>/

Not sure whether this is possible with OpenStack.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-04-19 20:20:16 -0600

Seen: 186 times

Last updated: Apr 21 '15