const context = {}; const markup = ReactDOMServer.renderToString( <StaticRouter location={req.url} context={context}> <App /> </StaticRouter> ); if (context.url) { // Somewhere a `<Redirect>` was rendered redirect(301, context.url); } else { // we're good, send the response }