#4701·floci

REST API not reachable on its execute-api host; request falls through to S3 and answers NoSuchBucket

Author: danielxoiCreated Sep 29, 2026Updated Sep 30, 2026
Labelsbugapigateway

A REST API (AWS::ApiGateway::RestApi, v1) is not reachable on the host shape of its invoke URL. GET http://<apiId>.execute-api.<region>.localhost.floci.io:4566/<stage>/... answers an S3 NoSuchBucket error for the stage segment; the same happens on <apiId>.execute-api.localhost.floci.io and <apiId>.execute-api.<region>.localhost. The path form /restapis/<apiId>/<stage>/_user_request_/... works.

Cause: ApiGatewayExecuteApiHostFilter only claims a host when the id resolves to an API Gateway v2 HTTP or WebSocket API. A REST API id fails that lookup, the filter declines, S3's virtual-host filter correctly declines too (execute-api is on its non-S3 label list), and the untouched /<stage>/... path reaches S3Controller's /{bucket} routes. Separately, extractApiId accepts a region label only before localhost, the configured hostname, or an AWS suffix, so even an HTTP API is unreachable on <apiId>.execute-api.<region>.localhost.floci.io, the shape a client derives from a stage's invoke URL.

The /execute-api/{apiId}/{stage} controller already dispatches both REST and HTTP APIs, so the filter can rewrite REST requests onto it. PR to follow.