From 114111c125c6a9eaae840aacf7d331302425dd0a Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Fri, 19 Jan 2024 18:31:37 +0100 Subject: [PATCH] better handle URL path when app if proxied --- CHANGES.md | 4 ++++ titiler/pgstac/main.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0c5913d..c57ad4a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Release Notes +## 1.2.1 (2024-01-19) + +* fix invalid url parsing in HTML responses + ## 1.2.0 (2024-01-17) * update titiler requirement to `>=0.17.0,<0.18` diff --git a/titiler/pgstac/main.py b/titiler/pgstac/main.py index 9e9a672..ee0c1d3 100644 --- a/titiler/pgstac/main.py +++ b/titiler/pgstac/main.py @@ -1,6 +1,7 @@ """TiTiler+PgSTAC FastAPI application.""" import logging +import re from contextlib import asynccontextmanager from typing import Dict @@ -265,6 +266,8 @@ def landing(request: Request): } urlpath = request.url.path + if root_path := request.app.root_path: + urlpath = re.sub(r"^" + root_path, "", urlpath) crumbs = [] baseurl = str(request.base_url).rstrip("/")