Search code examples
s3cmdceph

Can't get public bucket using Ceph API


I create public bucket from S3 client using comand:

s3cmd mb s3://public_bucket --acl-public
Bucket 's3://public_bucket/' created

I can see this bucket from client(s3cmd ls) and from rados gw (using radosgw-admin bucket list). But when I use the API and send the request to the server, I always get an error 404. Why is this happening? Apache, fcgi work fine.

My request:

GET /public-bucket?max-keys=15 HTTP/1.1
Host: ceph_gw.objectstore.com

Moreover, request

GET / HTTP/1.1
Host: ceph_gw.objectstore.com

give me response

HTTP/1.1 200 OK
Date: Thu, 27 Aug 2015 13:20:21 GMT
Server: Apache/2.2.15 (CentOS)
Connection: close
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?><ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>anonymous</ID><DisplayName></DisplayName></Owner><Buckets></Buckets></ListAllMyBucketsResult>

Solution

  • What you need to verify is from http headers if x-amz-acl is set to the appropriate value that you requested. If yes then perhaps there is something wrong with the server ACL code.

    You could alternatively try - https://github.com/minio/mc, which implements a console UI for http traffic.

    $ mc --debug mb http://ceph_gw.objectstore.com/yourbucket
    $ mc --debug access set public http://ceph_gw.objectstore.com/yourbucket
    

    Example

    $ mc --debug access set public s3/deflector
    mc: <DEBUG> PUT /deflector?acl= HTTP/1.1
    Host: s3.amazonaws.com
    User-Agent:  Minio/UNOFFICIAL.GOGET (mc; darwin; amd64)
    Content-Length: 0
    Authorization: AWS4-HMAC-SHA256 Credential=**REDACTED**/20151107/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-acl;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
    X-Amz-Acl: public-read-write
    X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
    X-Amz-Date: 20151107T002030Z
    Accept-Encoding: gzip
    
    mc: <DEBUG> HTTP/1.1 200 OK
    mc: <DEBUG> Response Time:  917.38277ms
    
    Set access permission ‘public’ updated successfully for ‘https://s3.amazonaws.com/deflector’