Skip to content

Conversation

RomanBobrovskiy
Copy link
Collaborator

Internationalization & Health Check Improvements

Overview

This PR implements i18n routes support, optimizes CloudFront caching configurations, adds advanced ElasticBeanstalk health check capabilities, and improves autoscaling performance.

Changes

Internationalization Support

  • Added handling for localized routes in Next.js rendering and caching
  • Now properly processes i18n routes with locale prefixes (e.g., /en-US/about) in cached routes configuration
  • Ensures proper caching and routing for multi-language applications

CloudFront Distribution Optimizations

  • Removed 'Cache-Control' from default forwarded headers list to improve cache hit ratio
  • Prevents unnecessary cache invalidation from varying Cache-Control headers

ElasticBeanstalk Improvements

  • Added custom health check path configuration:
    • Can now specify custom endpoint for health checks through healthCheckPath parameter
    • Default path is root (/) if not specified
  • Improved logging capabilities:
    • Enabled CloudWatch log streaming for better visibility into application performance
    • Added IAM permissions for proper log streaming management
  • Optimized auto-scaling settings:
    • Adjusted resource threshold triggers to improve cost efficiency
    • Modified upper threshold from 75% to 60% and lower threshold from 40% to 30% for earlier scaling actions

Infrastructure Quality of Life

  • Added consistent deployment configuration options
  • Parameter forwarding from deploy command to infrastructure stacks

Technical Details

  • Modified i18n route regex generation to properly account for locale prefixes
  • Added appropriate IAM permissions for CloudWatch logs integration
  • Propagated health check path configuration through deployment chain

How to Use

The health check path can now be specified in deployment configuration:

// next-serverless.config.js
module.exports = {
  cache: {
    // cache settings
  },
  healthCheckPath: '/api/health' // Custom health check endpoint
}

Testing

  • Tested with both i18n and non-i18n Next.js applications
  • Verified proper functioning of health checks with custom paths
  • Confirmed CloudWatch log streaming works correctly

@RomanBobrovskiy RomanBobrovskiy self-assigned this Apr 4, 2025
@RomanBobrovskiy RomanBobrovskiy merged commit ce3826f into main Apr 4, 2025
1 check passed
@RomanBobrovskiy RomanBobrovskiy deleted the feat/PLATFORM-2037 branch April 4, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant