SmooaiNextEdge: send origin Host to ALB by default (0.1.5)#4
Merged
Conversation
…(0.1.5) Stage C Phase 1 dogfood #2: the construct forwarded the VIEWER Host (allViewerAndWhitelistCloudFront) to the origin, but an EKS ALB Ingress routes by a fixed origin host (`host: web-origin.example.com`). So CloudFront sent `Host: web-next.smoo.ai`, matched no Ingress rule, and the ALB returned 404. (The live apex works only because sst.aws.Router rewrites Host to the origin.) Default the dynamic behavior to the AWS-managed `Managed-AllViewerExceptHostHeader` policy — forwards all cookies/auth/qs but NOT Host, so CloudFront sends the origin's host and the ALB routes correctly. Add `forwardViewerHost?: boolean` (default false) to opt back into viewer-host forwarding for host-agnostic origins. Also fixes the same 404 the Phase 2 apex swap would have hit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
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.
Problem (Stage C Phase 1 dogfood #2)
SmooaiNextEdgeforwarded the viewerHostto the origin (allViewerAndWhitelistCloudFront). But the canonical origin — an EKS ALB Ingress — routes by a fixed origin host (host: web-origin.example.com). So CloudFront sentHost: web-next.smoo.ai, matched no Ingress rule, and the ALB returned 404 (server: awselb/2.0). The live apex only works becausesst.aws.Routerrewrites Host to the origin.Fix
Default the dynamic (default) behavior to the AWS-managed
Managed-AllViewerExceptHostHeaderorigin-request policy — forwards all cookies/auth headers/query strings but notHost, so CloudFront sends the origin's own host and the ALB routes to the pods. AddforwardViewerHost?: boolean(defaultfalse) to opt back into viewer-host forwarding for host-agnostic origins.This also fixes the identical 404 the Phase 2 apex swap would have hit (apex
smoo.ai→ same ALB).Bumps
@smooai/deploy→ 0.1.5.Test
pnpm sst install && pnpm typecheckgreen (PR-checksconstructsgate). Validated end-to-end by smooaiweb-next.smoo.aiafter redeploy.🤖 Generated with Claude Code