Skip to content

Commit 8fa97fe

Browse files
Noah Boyersclaude
andcommitted
refactor: remove Cloudflare dependencies and add multi-region infrastructure
This commit consolidates infrastructure changes for AWS-native certificate management and expands multi-region deployment capabilities. ## Infrastructure Changes ### Certificate Management - Remove unused Cloudflare API token configuration across all regions - Simplify cert-manager, coder-proxy, and coder-server deployments - All regions now use AWS ACM for SSL/TLS (kubernetes_create_ssl_secret=false) ### New Infrastructure - Add Route53 DNS configuration for us-east-2 and us-west-2 - Add AWS ACM certificate management for us-west-2 - Add VPC peering configuration for us-east-2 - Add coder-server deployment for us-west-2 region ### Module Updates - Update Kubernetes bootstrap modules (cert-manager, coder-proxy, coder-server) - Update infrastructure modules (EBS controller, Karpenter, LB controller, metrics-server) - Improve EKS configurations across eu-west-2, us-east-2, and us-west-2 ## Documentation - Add INFRASTRUCTURE_BEST_PRACTICES.md - Add MULTI_REGION_DEPLOYMENT.md - Update ARCHITECTURE_DIAGRAM.md with current infrastructure state ## Configuration - Update .gitignore to exclude *.log files, backend.hcl, and terraform.tfvars.example - Prevent accidental commits of sensitive logs and backend configurations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 2be13f0 commit 8fa97fe

File tree

31 files changed

+2066
-124
lines changed

31 files changed

+2066
-124
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@ terraform.tfstate*
55
tf.plan
66
tfplan
77
*.tfplan
8+
*.log
89

910
# Backend configuration (contains sensitive IDs)
1011
backend.tf
1112
backend.tfvars
1213
*.backend.tfvars
14+
backend.hcl
15+
*.backend.hcl
1316

1417
# Terraform variable files (may contain sensitive IDs, ARNs, domains)
1518
*.tfvars
1619
!*.tfvars.example
17-
20+
terraform.tfvars.example
1821
# Helm + Kubernetes
1922
infra/aws/us-east-2/apps/coder-ws/experiment/prometheus.yaml
2023
infra/aws/us-east-2/apps/coder-devel/build-and-push

docs/ARCHITECTURE_DIAGRAM.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -622,27 +622,44 @@ This section documents expected behaviors in the demo environment that optimize
622622
- No security risk (just UX delay)
623623
- Users who bookmark or click links use HTTPS directly
624624

625-
**Workarounds:**
625+
**Why HSTS is NOT configured:**
626626

627-
- Always share URLs as `https://coderdemo.io`
628-
- Bookmark uses HTTPS automatically
629-
- Browser remembers HTTPS after first visit
627+
HSTS (HTTP Strict Transport Security) headers would help eliminate the "not secure" warning by making browsers automatically use HTTPS after the first visit. However, **Coder's HSTS feature does not work when behind a reverse proxy.**
630628

631-
**To eliminate (if needed):**
629+
**Investigation findings:**
630+
631+
- Coder supports HSTS via `CODER_STRICT_TRANSPORT_SECURITY` environment variable
632+
- However, Coder only sends HSTS headers when it directly terminates TLS (`CODER_TLS_ENABLE=true`)
633+
- When behind an NLB/reverse proxy with `CODER_TLS_ENABLE=false`, Coder sees incoming HTTP traffic
634+
- Coder's help states: "This header should only be set if the server is accessed via HTTPS"
635+
- Since Coder doesn't detect it's behind an HTTPS proxy, it won't send HSTS headers
636+
637+
**Workaround not possible without:**
632638

633-
- Option A: Add CloudFront with HTTP→HTTPS redirect
634-
- Option B: Switch to ALB (loses NLB benefits)
635-
- Option C: Configure port 80 forwarding in Coder service
639+
- Switching to ALB (which can do HTTP→HTTPS redirect at load balancer level)
640+
- Having Coder terminate TLS directly (loses NLB benefits)
641+
- Waiting for Coder to add reverse-proxy awareness for HSTS feature
642+
- Using CloudFront in front of NLB for HTTP→HTTPS redirect
643+
644+
**Alternative mitigation options:**
645+
646+
- Option A: Add CloudFront with HTTP→HTTPS redirect (adds complexity and cost)
647+
- Option B: Switch to ALB (loses NLB benefits: lower latency, source IP preservation)
648+
- Option C: Configure port 80 forwarding in Coder service (complex, not standard)
649+
- Option D: Accept current behavior (recommended for demo environment)
636650

637651
### Summary of Expected Load Times
638652

639653
| Scenario | Load Time | Behavior |
640654
| ------------------------- | --------------- | -------------------------------------------------- |
641655
| **First visit (HTTP)** | 7-13 seconds | HTTP:80 timeout (2-3s) + Aurora cold start (5-10s) |
642656
| **First visit (HTTPS)** | 5-10 seconds | Aurora cold start only |
643-
| **After warm-up** | <100ms | Instant, everything cached |
657+
| **Return visit (HTTP)** | 7-13 seconds | HTTP:80 timeout (2-3s) + Aurora cold start (5-10s) |
658+
| **After warm-up (HTTPS)** | <100ms | Instant, everything cached |
644659
| **Bookmarked/HTTPS link** | <100ms or 5-10s | Instant if warm, cold start if idle |
645660

661+
**Note:** Always share URLs as `https://coderdemo.io` to avoid the 2-3 second HTTP:80 timeout delay.
662+
646663
---
647664

648665
## Infrastructure as Code
@@ -783,7 +800,11 @@ modules/
783800

784801
## Changelog
785802

786-
- **2025-11-26**: Updated to reflect Aurora Serverless v2 configuration; added "Known Behaviors" section documenting cold start and HTTP redirect behavior for demo environment
803+
- **2025-11-26**:
804+
- Updated to reflect Aurora Serverless v2 configuration
805+
- Added "Known Behaviors" section documenting cold start and HTTP redirect behavior
806+
- Investigated and documented why HSTS cannot be configured when Coder is behind reverse proxy
807+
- Documented alternative mitigation options for HTTP→HTTPS redirect delay
787808
- **2025-11-25**: Initial architecture diagram created
788809

789810
---

0 commit comments

Comments
 (0)