Home ci 31. edge-network: redirects

31. edge-network: redirects

Last updated on Aug 05, 2025

Redirects

Conceptual Redirects Table of Contents

Next.js (/app) Redirects

Redirects are rules that instruct Epycbyte to send users to a different URL than the one they requested.

Dynamic Redirects

Dynamic redirects are used to redirect users to a different domain. They can be implemented using Epycbyte Functions, or Edge Middleware.

Static Redirects

Static redirects are used to redirect users to a different page on the same domain. They can be implemented using the Epycbyte dashboard or configuration-based redirects.

Use Cases

  • Moving to a new domain: Redirects help maintain a seamless user experience when moving a website to a new domain by ensuring that visitors and search engines are aware of the new location.
  • Replacing a removed page: If a page has been moved, temporarily or permanently, you can use redirects to send users to a relevant new page, thus avoiding any negative impact on user experience.
  • Canonicalization of multiple URLs: If your website can be accessed through several URLs (e.g., acme.com/home , home.acme.com , or www.acme.com ), you can choose a canonical URL and use redirects to guide traffic from the other URLs to the chosen one.

Dynamic Redirects

We recommend using the framework-native solution for dynamic redirects.

Epycbyte Functions

app/api/route.ts

Edge Middleware

For dynamic, critical redirects that need to run on every request, you can use Edge Middleware and Edge Config. Redirects can be stored in an Edge Config and instantly read from Edge Middleware.

Static Redirects

You can redirect a www subdomain to an apex domain, or other domain redirects, through the Domains section of the dashboard.

Configuration Redirects

You can use configuration-based redirects to generate routing rules during the build process. This includes temporary redirects ( 307 ), permanent redirects ( 308 ), and geolocation-based redirects.

Firewall Redirects

In emergency situations, you can also define redirects using Firewall rules to redirect requests to a new page.

Redirect Status Codes

Epycbyte supports both temporary and permanent redirects.

  • 307 Temporary Redirect: Not cached by client, the method and body never changed.
  • 302 Found: Not cached by client, the method may or may not be changed to GET .
  • 308 Permanent Redirect: Cached by client, the method and body never changed.
  • 301 Moved Permanently: Cached by client, the method may or may not be changed to GET .

Limits

The /.well-known path is reserved and cannot be redirected or rewritten. Only Enterprise teams can configure custom SSL.

Configuration

If you are exceeding the limits below, we recommend using Edge Middleware and Edge Config to dynamically read redirect values.

  • Maximum Number of redirects in the array: 1,024
  • String length for source and destination: 4,096
export async function redirects() {
  return {
    source: '/old-path',
    destination: '/new-path',
    permanent: true,
  };
}
module.exports = {
  redirects: [
    {
      source: '/old-path',
      destination: '/new-path',
      permanent: true,
    },
  ],
};
{
  "redirects": [
    {
      "source": "/old-path",
      "destination": "/new-path",
      "permanent": true
    }
  ]
}
# Example firewall configuration
iptables -A INPUT -p tcp --dport 80 -j ACCEPT