Skip to content

Commit d5cd2dc

Browse files
authored
add /_extension to well-known path prefixes to avoid s3 fallback handling (#11796)
1 parent 359f45f commit d5cd2dc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

localstack-core/localstack/aws/protocol/service_router.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ def custom_path_addressing_rules(path: str) -> Optional[ServiceModelIdentifier]:
171171
return ServiceModelIdentifier("lambda")
172172

173173

174+
well_known_path_prefixes = (
175+
"/_aws",
176+
"/_localstack",
177+
"/_pods",
178+
"/_extension",
179+
)
180+
181+
174182
def legacy_rules(request: Request) -> Optional[ServiceModelIdentifier]:
175183
"""
176184
*Legacy* rules which migrate routing logic which will become obsolete with the ASF Gateway.
@@ -192,8 +200,9 @@ def legacy_rules(request: Request) -> Optional[ServiceModelIdentifier]:
192200

193201
# TODO Remove once fallback to S3 is disabled (after S3 ASF and Cors rework)
194202
# necessary for correct handling of cors for internal endpoints
195-
if path.startswith("/_localstack") or path.startswith("/_pods") or path.startswith("/_aws"):
196-
return None
203+
for prefix in well_known_path_prefixes:
204+
if path.startswith(prefix):
205+
return None
197206

198207
# TODO The remaining rules here are special S3 rules - needs to be discussed how these should be handled.
199208
# Some are similar to other rules and not that greedy, others are nearly general fallbacks.

0 commit comments

Comments
 (0)