简体   繁体   中英

Configure CORS in IBM Cloud Object Storage Bucket using CLI

I am trying to configure CORS in my IBM Cloud Object Storage bucket. I dont see any option to do that from bucket configuration in UI and I can see it can only be done through CLI. The command looks similar to how its done in AWS CLI as well. This is the command to configure CORS,

ibmcloud cos bucket-cors-put --bucket BUCKET_NAME [--cors-configuration STRUCTURE] [--region REGION] [--output FORMAT]

It is expecting cors configuration STRUCTURE in JSON format from a file and add it as --cors-configuration file://<filename.json> . I have created a configuration file as cors.json and saved it on my Desktop. But when I am providing path for that file and running the command, I am getting this error, The value in flag '--cors-configuration' is invalid

I am providing file path like this - --cors-configuration file:///C:/Users/KirtiJha/Desktop/cors.json

I am new with Cloud CLI. Am I doing wrong here? Any help is much appreciated

You can configure CORS in the CLI or via API and SDKs . On the CLI, you can use the IBM Cloud COS plugin in the bucket-cors-put command as you mentioned.

The file URI seems valid to me. You could try to set it in quotes ("file:///..."). Also, try to copy the file into your current directory and then test with --cors-configuration file://cors.json .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM