Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for latest lambda-proxy version #1

Open
vincentsarago opened this issue Sep 12, 2019 · 0 comments
Open

Update for latest lambda-proxy version #1

vincentsarago opened this issue Sep 12, 2019 · 0 comments

Comments

@vincentsarago
Copy link

There was a change recently on lambda-proxy (used byt the tiler) which will make the tiler fail here

host = request["headers"].get(
"X-Forwarded-Host", request["headers"].get("Host", "")
)
# Check for API gateway stage
if ".execute-api." in host and ".amazonaws.com" in host:
stage = request["requestContext"].get("stage", "")
host = f"{host}/{stage}"
scheme = "http" if host.startswith("127.0.0.1") else "https"
qs = [f"{k}={v}" for k, v in kwargs.items()]
qs = "&".join(qs)
tile_url = f"{scheme}://{host}/tiles/{{z}}/{{x}}/{{y}}.{tile_format}?url={url}"

Instead of the whole block to retrieve the host url, you can now use APP.host. see implementation in https://github.com/vincentsarago/lambda-tiler/blob/master/lambda_tiler/handler.py#L114-L128

cc @abarciauskas-bgse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant