Skip to content

Conversation

RomanBobrovskiy
Copy link
Collaborator

Add Support for Next.js Redirects and Trailing Slashes

Overview

This PR adds support for Next.js redirects and trailing slashes configuration, improves route handling, and updates the Elastic Beanstalk platform versions.

Key Changes

1. Next.js Redirects Support

  • Added support for Next.js redirects configuration
  • Implemented redirect handling in viewer request Lambda@Edge
  • Added proper status code handling for redirects (307/308)
  • Added support for locale-based redirects

2. Next.js Rewrites Support

  • Added support for Next.js rewrites configuration
  • Implemented rewrites handling in viewer request Lambda@Edge

3. Route Handling Improvements

  • Moved rewrite logic from origin request to viewer request Lambda
  • Added unified route handling utility (nextRoute.ts)
  • Added support for dynamic route parameters
  • Improved handling of query parameters and headers

4. Trailing Slashes Support

  • Added support for Next.js trailingSlash configuration
  • Implemented consistent trailing slash handling across redirects and rewrites
  • Added configuration option isTrailingSlashEnabled

5. Platform Updates

  • Updated Elastic Beanstalk platform versions to:
    • Node.js 18: 64bit Amazon Linux 2023 v6.4.3
    • Node.js 20: 64bit Amazon Linux 2023 v6.4.3

@RomanBobrovskiy RomanBobrovskiy self-assigned this Feb 28, 2025
@RomanBobrovskiy RomanBobrovskiy merged commit df524f2 into main Mar 3, 2025
1 check passed
@RomanBobrovskiy RomanBobrovskiy deleted the feat/PLATFORM-1972 branch March 3, 2025 09:45
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.

2 participants