-
Notifications
You must be signed in to change notification settings - Fork 80
Bucket Website Support
You can use NooBaa Website Bucket to host static websites or static assets of your web application. A static website serves the website content over http/s and allows anonymous read access.
To host a static website on NooBaa, you configure a bucket for website hosting and then upload your website content to the bucket. When you configure a bucket as a static website, you must enable website hosting, set permissions, and create and add an index document and optional custom error document.
For website buckets the "Bucket Policy" configuration should be set to allow anonymous GET requests.
Use aws-cli to set the bucket policy:
aws s3api get-bucket-policy --bucket first.bucket
aws s3api put-bucket-policy --bucket first.bucket --policy '{
"Version": "2012-10-17",
"Statement": [{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": "*",
"Action": ["s3:GetObject"],
"Resource": ["arn:aws:s3:::first.bucket/*"]
}]
}'
Then the bucket website configuration should be set:
aws s3api put-bucket-website --bucket first.bucket --website-configuration '{
"ErrorDocument": { "Key": "string" },
"IndexDocument": { "Suffix": "string" },
"RedirectAllRequestsTo": {
"HostName": "string",
"Protocol": "http" | "https"
},
"RoutingRules": [{
"Condition": {
"HttpErrorCodeReturnedEquals": "string",
"KeyPrefixEquals": "string"
},
"Redirect": {
"HostName": "string",
"HttpRedirectCode": "string",
"Protocol": "http" | "https",
"ReplaceKeyPrefixWith": "string",
"ReplaceKeyWith": "string"
}
}
...
]
}'
Discover the endpoint addresses with the following options:
- Run noobaa-operator status command which will output the S3 Addresses
- View the NooBaa CR (kubectl get -o yaml noobaas noobaa -n namespace_name) and locate the serviceS3 field
These are the protocols for the endpoints:
- HTTP (not implemented)
- HTTPS (supported)
These are the types of endpoints:
- Path style i.e www.domain.com/bucket_name (supported)
- Virtual hosts i.e www.bucket_name.domain.com (supported)
- Virtual hosts can be added via NooBaa CR additionalVirtualHosts field
- Dedicated website regions i.e http://bucket-name.s3-website-Region.domain.com, http://bucket-name.s3-website.Region.domain.com (not implemented)
bucket_name can be either OBC or non-OBC bucket
- Delete Bucket Website - Fully supported
- Get Bucket Website - Fully supported
- Put Bucket Website - Fully supported except:
- Routing Rules - not implemented