POST /api/domain/update-lambda-edge
Updates the Lambda@Edge function and propagates changes to all CloudFront distributions.Purpose
This endpoint:- Reads the current
lambda_code.jsfile (with updated bot patterns) - Uploads it to AWS Lambda and publishes a new version
- Updates ALL CloudFront distributions to use the new version
Architecture
Use Cases
- Update bot detection patterns
- Fix Lambda@Edge bugs
- Deploy new routing logic
- Update AI crawler handling
Internal Services
update_lambda_edge
Handles the Lambda update and CloudFront propagation. Location:src/app/apis/domain/update_lambda_edge/handler.py
generate_lambda_code
Generates the Lambda@Edge code with current bot patterns. Location:src/app/apis/domain/update_lambda_edge/generate_lambda_code.py
Lambda@Edge Function
The Lambda@Edge function runs at CloudFront edge locations and:- Detects AI bot user agents
- Routes AI bots to the AI-optimized site
- Routes regular users to the origin
Propagation Time
CloudFront distribution updates typically take 5-15 minutes to propagate globally.Response Fields
| Field | Type | Description |
|---|---|---|
status | string | βsuccessβ or error |
lambda_version | string | New Lambda version number |
distributions_updated | integer | Number of distributions updated |