Skip to content

API endpoint to expose redirects for headless Next.js implementation #171

@IOSven

Description

@IOSven

Environment

  • Optimizely CMS: v12.29.0
  • Geta.NotFoundHandler: v5.0.13
  • Frontend: Next.js (headless implementation)

Description

We're implementing a headless Optimizely solution with a Next.js frontend. We have installed the Geta NotFoundHandler package to manage redirects in our backend Optimizely CMS system, but these redirects need to be executed in our frontend Next.js application.

Request

We need a way to expose the redirects configured in the Geta NotFoundHandler through an API endpoint that our Next.js application can consume. This would allow our frontend to:

  1. Retrieve all configured redirects from the CMS
  2. Handle 404s and redirects appropriately on the frontend

Questions

  1. Is there any built-in functionality in Geta NotFoundHandler to expose redirects via an API endpoint?
  2. If not, what would be the recommended approach to build such an endpoint?
  3. Are there any best practices or examples for implementing this in a headless architecture?

Additional Context

In our headless architecture, the Optimizely CMS serves as the content backend while the Next.js application handles all frontend rendering and routing. When users access invalid URLs, we want to handle the redirects on the frontend side using the rules configured in the CMS through the NotFoundHandler.

Thank you for your assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions