IBM Object Storage-How to make a File or a Container public accesible one?

111 views Asked by At

I have uploaded a file from local to the IBM Storage container using Node js In the response I have got the baseResourceUrl (https://dal.objectstorage.open.softlayer.com:443/v1/AUTH_bf7 d89eb565f4c638d7b6f7b15e73538/testContainer/test.png)

The URL is not accesible in the browser.It says Unauthorized

In my usecase I need to access publicly anywhere.Is that possible? If possible how to give public access to files.

I am new to IBM Bluemix environment and Object Storage service.Kindly share some solutions

1

There are 1 answers

1
Michael Petersen On BEST ANSWER

After uploading the file you'll need to modify the ACLs. You'll end up creating a Read ACL for the container: testContainer.

I was able to test this using the Swift CLI, however you can use the curl examples to figure out what you'll need to write using Node.

Swift Example (assumes you have ENV variables exported):

swift post testContainer --read-acl ".r:*,.rlistings"

Curl with AUTH_TOKEN:

$ curl -X PUT -i \
>         -H "X-Auth-Token: AUTH_TOKEN" \
>         -H "X-Container-Read: .r:*,.rlistings" \
>         https://dal.objectstorage.open.softlayer.com/v1/AUTH_bf7d89eb565f4c638d7b6f7b15e73538/testContainer

https://www.swiftstack.com/docs/cookbooks/swift_usage/container_acl.html#setting-container-read-acl

If we go back to the swift client we can view the current ACLs in place:

swift stat -v testContainer

Which will return data about the container:

Read ACL: .r:*,.rlistings
Write ACL: