Configure CORS
Instructions for configuring cross-origin resource sharing for AWS S3, GCS, and Microsoft Azure.
CORS (Cross-origin resource sharing) is a browser mechanism that enables restricted access across domain boundaries that would otherwise be prohibited by default browser restrictions. The CORS header enables Labelbox to send a pre-flight request to your cloud storage and enables your cloud storage to explicitly allow requests from Labelbox. If the Labelbox domains are included in the CORS header, Labelbox will be able to request resources from your cloud storage.
When configuring CORS for your cloud storage bucket, you will need to include both of these Labelbox origins: https://app.labelbox.com
and https://editor.labelbox.com
.
AWS S3
-
In your AWS account, go to your S3 Management Console.
-
Click the bucket name in the list of buckets.
-
Go to the Permissions tab.
-
In the Cross-origin resource sharing (CORS) section, click Edit.
-
Paste the following configuration in the text field.
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"https://app.labelbox.com",
"https://editor.labelbox.com"
],
"ExposeHeaders": []
}
]
-
Click Save changes.
-
For more details on setting up CORS for your AWS S3 bucket, see these AWS docs.
Google Cloud Storage (GCS)
In the following commands, replace with your own bucket name (ex: gs://my-bucket)
-
Log in to the Google Cloud Platform console.
-
Click the Activate Cloud Shell button in the top-right corner to open the Cloud Shell.
-
In Cloud Shell, create a JSON file containing the CORS configuration by entering the following command:
echo '[{"origin":["https://app.labelbox.com","https://editor.labelbox.com"],"method":["GET"],"responseHeader":["*"]}]' > cors-config.json
- Apply the CORS configuration to the bucket using the following command:
gsutil cors set cors-config.json gs://<bucket-name>
- Check the CORS configuration using the following command:
gsutil cors get gs://<bucket-name>
Microsoft Azure
-
Log into your Microsoft Azure portal.
-
Navigate to the desired Storage Account.
-
In the left pane, click Settings > Resource sharing (CORS).
-
Select the Blob Service tab.
-
Enter the following settings.
- Click Save.
Troubleshooting
Error message | Troubleshooting |
---|---|
Unable to detect proper CORS configuration | Ensure your cloud storage bucket has CORS configured with the following origins: https://app.labelbox.com and https://editor.labelbox.com .For more troubleshooting help, see: - AWS troubleshooting CORS - GCS troubleshooting CORS requests - Cross-Origin Resource Sharing (CORS) support for Azure Storage |
Updated 4 months ago