-
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 gut-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"
}
}
...
]
}'
(See https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html)
TODO: Document which endpoints can be used to access the website:
- How to discover the endpoint addresses
- How to use with OBC?
- How to use without OBC?
- Mention if we can use both http and https
- Can we set custom bucket domain?
- Delete Bucket Website - Fully supported
- Get Bucket Website - Fully supported
- Put Bucket Website - Fully supported except:
- Routing Rules - not implemented