mirror of
https://github.com/versity/versitygw.git
synced 2026-07-02 16:54:25 +00:00
ac5c3b4a86
Add S3 bucket website configuration types with XML serialization support in s3response/website.go. Includes IndexDocument, ErrorDocument, RedirectAllRequestsTo, and RoutingRules with full validation matching AWS S3 behavior. Add corresponding S3 error codes: ErrNoSuchWebsiteConfiguration, ErrInvalidWebsiteConfiguration, ErrInvalidWebsiteSuffix, and ErrInvalidWebsiteRedirectCode. Unit tests cover validation logic, XML round-trip, and parsing. Signed-off-by: Marc Singer <marc@singer.gg> Add website backend interface and implementations for posix and s3proxy Add PutBucketWebsite, GetBucketWebsite, and DeleteBucketWebsite methods to the Backend interface with BackendUnsupported stubs that return ErrNotImplemented. Posix backend stores website config as a metadata attribute (key: 'website') following the same pattern as CORS. ScoutFS inherits via embedding. S3Proxy backend stores website config in the metadata bucket with prefix 'vgw-meta-website-', consistent with existing ACL/policy/CORS metadata storage. Returns ErrNoSuchWebsiteConfiguration when not found. Signed-off-by: Marc Singer <marc@singer.gg> Add website API controllers and wire into router Add PutBucketWebsite, GetBucketWebsite, and DeleteBucketWebsite controller methods following the same pattern as CORS. Controllers parse and validate WebsiteConfiguration XML, check IAM authorization, and delegate to the backend. Replace the three HandleErrorRoute(ErrNotImplemented) stubs in the router with the new controller methods. Regenerate the backend mock to include the new interface methods. Signed-off-by: Marc Singer <marc@singer.gg> Add website index document middleware and wire into router Add ResolveWebsiteIndex middleware that rewrites directory-like object keys (empty or ending with /) to include the IndexDocument suffix when website hosting is enabled. Also handles RedirectAllRequestsTo by returning 301. Wire the middleware into both GetObject and HeadObject handler chains in the router, positioned after BucketObjectNameValidator and before auth. Signed-off-by: Marc Singer <marc@singer.gg>