mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
Update README.md
This commit is contained in:
31
js/README.md
31
js/README.md
@@ -60,10 +60,39 @@ Reading a PMTiles archive from cloud storage requires [CORS](https://developer.m
|
|||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"origin": ["*","example.com"],
|
"origin": ["example.com","*"],
|
||||||
"method": ["GET","HEAD"],
|
"method": ["GET","HEAD"],
|
||||||
"responseHeader": ["range","etag"],
|
"responseHeader": ["range","etag"],
|
||||||
"maxAgeSeconds": 3000
|
"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`
|
||||||
|
|||||||
Reference in New Issue
Block a user