Conversation
An origin whose domain is a bucket REST endpoint (`<bucket>.s3.<region>.amazonaws.com` -- what `S3OriginConfig` origins and CDK's `S3BucketOrigin` carry) resolves in real DNS, so the data plane proxied the fetch to real AWS S3 and the distribution never served the bucket. Route it to this process like an S3-website origin, keeping the bucket domain in `Host` so the S3 front door resolves it virtual-hosted style. An explicit `CustomOriginConfig` still wins.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An origin whose domain is a bucket REST endpoint
(
<bucket>.s3.<region>.amazonaws.com-- whatS3OriginConfigorigins andCDK's
S3BucketOrigincarry) resolves in real DNS, so the data planeproxied the fetch to real AWS S3 and the distribution never served the
bucket. Route it to this process like an S3-website origin, keeping the
bucket domain in
Hostso the S3 front door resolves it virtual-hostedstyle. An explicit
CustomOriginConfigstill wins.Test plan
Regression test:
serves_static_from_s3_rest_originincrates/fakecloud-e2e/tests/cloudfront_dataplane.rsVerification
On this exact head, rebased onto current
main:cargo fmt --all --check- clean.cargo clippy --workspace --all-targets -- -D warnings- clean.cargo test --workspaceexcludingfakecloud-e2e,fakecloud-conformance,fakecloud-tfaccandfakecloud-parity(the same set CI'stestjob runs),plus
cargo test -p fakecloud-conformance --lib- 9931 passed, 0 failed.cargo test -p fakecloud-e2e --test cloudfront_dataplane- the regressiontest above passes against a freshly built
target/debug/fakecloud.Found by deploying a CDK CloudFront + S3 SPA against fakecloud.
Summary by cubic
Fixes CloudFront data plane routing for S3 REST origins so the bucket is served from the local process instead of being proxied to real AWS S3.
Origins with a bucket REST domain (
<bucket>.s3.<region>.amazonaws.com, whatS3OriginConfigand CDK'sS3BucketOrigincarry) resolve in real DNS, so the fetch went to AWS and the distribution never served the bucket. These now route to the local S3 front door like S3-website origins, keeping the bucket domain inHost. An explicitCustomOriginConfigstill wins.Adds
serves_static_from_s3_rest_origintocrates/fakecloud-e2e/tests/cloudfront_dataplane.rsas a regression test.Written for commit 0455356. Summary will update on new commits.