[英]Configure CORS in IBM Cloud Object Storage Bucket using CLI
I am trying to configure CORS in my IBM Cloud Object Storage bucket.我正在尝试在我的 IBM Cloud Object 存储桶中配置 CORS。 I dont see any option to do that from bucket configuration in UI and I can see it can only be done through CLI.
我在 UI 中的存储桶配置中看不到任何选项,我可以看到它只能通过 CLI 完成。 The command looks similar to how its done in AWS CLI as well.
该命令看起来也类似于它在 AWS CLI 中的完成方式。 This is the command to configure CORS,
这是配置 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>
.它期望从文件中以 JSON 格式的 cors 配置结构 STRUCTURE 并将其添加为
--cors-configuration file://<filename.json>
。 I have created a configuration file as cors.json and saved it on my Desktop.我创建了一个配置文件 cors.json 并将其保存在我的桌面上。 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
但是当我为该文件提供路径并运行命令时,我收到此错误,标志“--cors-configuration”中的值无效
I am providing file path like this - --cors-configuration file:///C:/Users/KirtiJha/Desktop/cors.json
我提供这样的文件路径 -
--cors-configuration file:///C:/Users/KirtiJha/Desktop/cors.json
I am new with Cloud CLI.我是 Cloud CLI 的新手。 Am I doing wrong here?
我在这里做错了吗? Any help is much appreciated
任何帮助深表感谢
You can configure CORS in the CLI or via API and SDKs .您可以在 CLI 中或通过 API 和 SDK配置 CORS 。 On the CLI, you can use the IBM Cloud COS plugin in the bucket-cors-put command as you mentioned.
在 CLI 上,您可以在您提到的bucket-cors-put 命令中使用 IBM Cloud COS 插件。
The file URI seems valid to me.文件 URI 对我来说似乎有效。 You could try to set it in quotes ("file:///...").
您可以尝试将其设置在引号中(“file:///...”)。 Also, try to copy the file into your current directory and then test with
--cors-configuration file://cors.json
.另外,尝试将文件复制到当前目录,然后使用
--cors-configuration file://cors.json
进行测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.