mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
update js README to refer to docs site.
This commit is contained in:
58
js/README.md
58
js/README.md
@@ -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`
|
|
||||||
|
|||||||
Reference in New Issue
Block a user