Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion docs/URL_FIX_DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ La función se asoció con todos los cache behaviors de CloudFront para asegurar
## Archivos Modificados

1. **mkdocs.yml**: Agregada configuración `use_directory_urls: true`
2. **terraform/cloudfront.tf**:
2. **terraform/cloudfront.tf**:
- Agregada CloudFront Function `url_rewrite`
- Asociada la función con todos los cache behaviors
3. **terraform/cloudfront-staging.tf**:
- Aplicada la misma CloudFront Function a staging
- Asociada la función con todos los cache behaviors de staging

## Despliegue

Expand All @@ -67,11 +70,19 @@ Para aplicar estos cambios:
## Verificación

Después del despliegue, verificar que funcionen:

### Producción
- ✅ `https://pythoncdmx.org/meetups/`
- ✅ `https://pythoncdmx.org/meetups/index.html`
- ✅ `https://pythoncdmx.org/about/`
- ✅ `https://pythoncdmx.org/about/index.html`

### Staging
- ✅ `https://staging.pythoncdmx.org/meetups/`
- ✅ `https://staging.pythoncdmx.org/meetups/index.html`
- ✅ `https://staging.pythoncdmx.org/about/`
- ✅ `https://staging.pythoncdmx.org/about/index.html`

## Notas Técnicas

- La CloudFront Function se ejecuta en el edge, por lo que tiene latencia mínima
Expand Down
27 changes: 27 additions & 0 deletions terraform/cloudfront-staging.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ resource "aws_cloudfront_origin_access_control" "website_staging" {
signing_protocol = "sigv4"
}

# CloudFront Function for staging (reuse the same function as production)
# Note: CloudFront Functions are global, so we can reference the same function

# CloudFront distribution for staging
resource "aws_cloudfront_distribution" "website_staging" {
enabled = true
Expand Down Expand Up @@ -42,6 +45,12 @@ resource "aws_cloudfront_distribution" "website_staging" {
default_ttl = 300 # 5 minutes - shorter cache for staging
max_ttl = 3600 # 1 hour - shorter cache for staging
compress = true

# Associate CloudFront Function for URL rewriting (same as production)
function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.url_rewrite.arn
}
}

# Cache behavior for static assets (CSS) - shorter cache for staging
Expand All @@ -63,6 +72,12 @@ resource "aws_cloudfront_distribution" "website_staging" {
default_ttl = 1800 # 30 minutes
max_ttl = 7200 # 2 hours
compress = true

# Associate CloudFront Function for URL rewriting
function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.url_rewrite.arn
}
}

# Cache behavior for static assets (JS) - shorter cache for staging
Expand All @@ -84,6 +99,12 @@ resource "aws_cloudfront_distribution" "website_staging" {
default_ttl = 1800 # 30 minutes
max_ttl = 7200 # 2 hours
compress = true

# Associate CloudFront Function for URL rewriting
function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.url_rewrite.arn
}
}

# Cache behavior for images - shorter cache for staging
Expand All @@ -105,6 +126,12 @@ resource "aws_cloudfront_distribution" "website_staging" {
default_ttl = 3600 # 1 hour
max_ttl = 86400 # 24 hours
compress = true

# Associate CloudFront Function for URL rewriting
function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.url_rewrite.arn
}
}

# Custom error responses for SPA-like behavior
Expand Down