Skip to main content
Version: v0.x

Match both root and www requests

In some cases, you may want a Route to match incoming requests to the root domain and the corresponding www subdomain.

Instead of creating a separate Route for each one, we can supply alsoMatchWWWSubdomain to match both root and www subdomain requests. This Route will send both proxyflare.works/api/* and www.proxyflare.works/api/* to Route["to.url"].

functions/_middleware.ts
const routes = [
{
from: { pattern: "proxyflare.works/api/*", alsoMatchWWWSubdomain: true },
to: { url: "ec2-5-55-555-55.compute-1.amazonaws.com:8787" },
},
]