Read API paths and forwarded requests as the router does

The router reads an absolute-form target's path without resolving dot
segments, so a target such as http://host/api/../x still reaches /api
middleware. Take that path the same way when deciding whether the API
response headers apply.

The Street View fallback now treats any forwarding header as forwarded, even
an empty one, before it spends the key.
This commit is contained in:
Sameh Khamis committed 2026-10-21 15:43:29 -07:00
1 parent afe05454d9
commit b75db874c6
5 files changed
+32 -8

No files matched your search

+3
View File
@@ -491,6 +491,9 @@ test('a forwarded same-origin request reaches every CCTV route but not the Stree
{ via: '1.1 proxy' },
{ forwarded: 'for=203.0.113.9' },
{ 'x-real-ip': '203.0.113.9' },
{ 'x-forwarded-for': '' },
{ 'x-forwarded-for': ' ' },
{ 'cf-connecting-ip': '' },
]) {
const headers = { host, 'sec-fetch-site': 'same-origin', ...forwarded };
const label = JSON.stringify(forwarded);