From 5787962dcf1fa436a974fc081a4b5b5d1f3ebcfd Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Sat, 30 Jul 2022 11:39:42 +0800 Subject: [PATCH] Update README.md --- serverless/aws/README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/serverless/aws/README.md b/serverless/aws/README.md index b48f492..5c78f27 100644 --- a/serverless/aws/README.md +++ b/serverless/aws/README.md @@ -4,6 +4,12 @@ Generates a Lambda function for deploying PMTiles on Lambda behind Lambda Functi ## How To Use +Self-contained Lambda ZIP: + +[protomaps.github.io/PMTiles/lambda_function.zip](https://protomaps.github.io/PMTiles/lambda_function.zip) + +Building the Lambda ZIP yourself: + ```sh git clone https://github.com/protomaps/PMTiles cd serverless/aws @@ -18,8 +24,9 @@ Configure these Lambda environment variables: * `PMTILES_PATH`: optional, define how a tileset name is translated into an S3 key. Default `{name}.pmtiles` * Example path setting for objects in a directory: `my_folder/{name}/file.pmtiles` * `TILE_PATH`: optional, define the URL route of the tiles API. Default `/{name}/{z}/{x}/{y}.pbf` +* `CORS`: optional, the exact value of the `Access-Control-Allow-Origin` header in the Lambda response. Note that this header will be cached by CloudFront; if you need dynamic multiple-origin support with CloudFront you should use [CloudFront Functions](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-functions.html) instead. -For API Gateway integration, your Lambda Proxy Integration route will need to specify a greedy capturing parameter called `proxy` e.g. `/{proxy+}` (the default). Also, your binary content types setting for REST APIs needs to be set to `*/*` otherwise tiles will be returned as base64-encoded text. +For API Gateway integration, your Lambda Proxy Integration route will need to specify a greedy capturing parameter called `proxy` e.g. `/{proxy+}` (the default). API Gateway responses will always be GZIP-encoded. ## Test Event @@ -36,12 +43,11 @@ API Gateway (HTTP or REST): ```json { "pathParameters": { - "tile_path": "my-tileset-name/0/0/0.pbf" + "proxy": "my-tileset-name/0/0/0.pbf" } } ``` - ### Monitoring