Skip to content

SPA

To deploy a single-page application (SPA) with more than a single route, you must either use puppet routing or an Edge Function to prevent 404 Not Found errors. Please see the following example of an Edge Function for routing purposes.

export async function handler(request: Request) {
const response = await fetch(
'https://' + new URL(request.url).host + '/index.html'
);
return new Response(response.body, {
headers: { 'Content-Type': 'text/html' },
});
}

Please see Static Web Apps for more information.