update js README to refer to docs site.

This commit is contained in:
Brandon Liu
2022-12-03 00:04:33 +08:00
committed by GitHub
parent ca4c8094a8
commit b1dd582609

View File

@@ -48,60 +48,4 @@ var style = {
# CORS # CORS
Reading a PMTiles archive from cloud storage requires [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) configuration if your web page is hosted on a different domain than your storage bucket. See the [Protomaps Docs on Cloud Storage](https://protomaps.com/docs/pmtiles/cloud-storage) for uploading and configuring CORS for Cloudflare R2, Amazon S3, Google Cloud Storage and more.
## Amazon S3 and S3-Compatible Storage
```json
[
{
"AllowedHeaders": ["Range"],
"AllowedMethods": ["GET","HEAD"],
"AllowedOrigins": ["*","example.com"],
"ExposeHeaders": ["ETag"],
"MaxAgeSeconds": 3000
}
]
```
## Google Cloud Storage
```json
[
{
"origin": ["example.com","*"],
"method": ["GET","HEAD"],
"responseHeader": ["range","etag"],
"maxAgeSeconds": 3000
}
]
```
### Setting CORS from the command line
[AWS CLI](https://aws.amazon.com/cli/) is the recommended way to do this:
create a file `cors_rules.json`:
```json
{
"CORSRules": [
{
"AllowedOrigins": ["example.com","*"],
"AllowedHeaders": ["range"],
"AllowedMethods": ["GET","HEAD"],
"MaxAgeSeconds": 3000,
"ExposeHeaders": ["ETag"]
}
]
}
```
Then configure your bucket with:
```sh
aws s3api put-bucket-cors --bucket MY_BUCKET --cors-configuration file:///home/user/cors_rules.json
```
Optional arguments:
* `-endpoint-url https://S3_COMPATIBLE_ENDPOINT`: for non-S3 storages.
* `--profile PROFILE`: choose credentials named in `~/.aws/credentials`