How to set CORS policy on DreamObjects using AWS CLI?

Wanted to follow your Knowledge Base tutorial on setting the DreamObjects CORS policy (5 years old), which suggests using S3cmd. Got ready to install S3cmd, only to learn from that tutorial, one should instead use the pre-installed (and currently developed) AWS CLI tool. Great… cofigured it as suggested and it works with your example commands. Now, how do I get/set/put a CORS policy for a bucket using this tool??

It would be super helpful if these KB articles could be updated once the suggested practices change. This whole objects realm is so new to me, need as much tutorial guidance as possible.

Nevertheless, have been researching the official AWS CLI docs for workflow on put-bucket-cors / get-bucket-cors – but definitely need help for the DreamObjects unique workflow.

Fumbling around, I got as close as learning I need to use the mediastore function, then ran into the obsticle of what exactly to enter for --container-name (guessing my bucket name) – tried that (also just to list the containers):
aws --endpoint-url mediastore list-containers

but both receive an error:
You must specify a region. You can also configure your region by running "aws configure".

On the DH AWS CLI install/configure tutorial, it said to just hit enter and leave that blank… hmm any help would be much appreciated.

End goal is uploading/serving videos as m3u8 and ts files for HLS streaming (with private setting of object files) – this tutorial suggested it’s like a CORS issue causing the issue of accessing each file from the playlist.

Ended up solving setting the CORS using the older S3cmd (which is installed and works – just wish updated workflow suggestions included updated tutorials).

Regarding my ultimate goal of streaming HLS video (m3u8 + ts files) set to private from DreamObjects… hit a fail wall. Can create signed urls per file – but that only really works for initial m3u8 playlist… all files referenced within also need signed urls (tried parsing this with htaccess + php… got close, but no cigar) – in the end, it would be awesome if DreamObjects offered something like signed cookies – which are intended for giving access to a group of files, ie. HLS stream. Until then… no fancy streaming… just direct linking to singular mp4 files with signed urls.

Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own.

For security reasons, browsers restrict cross-origin HTTP requests initiated from scripts. For example, XMLHttpRequest and the Fetch API follow the same-origin policy. This means that a web application using those APIs can only request resources from the same origin the application was loaded from unless the response from other origins includes the right CORS headers.

I am glad that you will be able to solve the issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.