Skip to content

Commit 7d0088b

Browse files
committed
Fix OSM proxy response format by forwarding all headers
1 parent 66f4b72 commit 7d0088b

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

api/main.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,14 @@ async def catch_all(
190190
)
191191

192192
client = _osm_client
193-
new_headers = list()
194-
new_headers.append(
195-
(bytes("Authorization", "utf-8"), request.headers.get("Authorization"))
196-
)
197193

198-
if authorizedWorkspace is not None:
199-
new_headers.append(
200-
(
201-
bytes("X-Workspace", "utf-8"),
202-
bytes(str(authorizedWorkspace), "utf-8"),
203-
)
204-
)
194+
# Forward all request headers except the hop-by-hops:
195+
new_headers = [
196+
(k.encode(), v.encode())
197+
for k, v in request.headers.items()
198+
if k.lower() not in HOP_BY_HOP_HEADERS
199+
]
205200

206-
new_headers.append((bytes("Host", "utf-8"), bytes(client.base_url.host, "utf-8")))
207201
rp_req = client.build_request(
208202
request.method, url, headers=new_headers, content=request.stream()
209203
)

0 commit comments

Comments
 (0)