I’m using NextJS and I’d like to fall back to my legacy system. How do I do that?
in layer0.config.js
module.exports = {
connector: '@layer0/next',
legacy: {
domainOrIp: process.env.LEGACY_WWW_BACKEND,
hostHeader: process.env.LEGACY_WWW_BACKEND_HOST_HEADER,
},
},
};
in routes.js
module.exports = new Router()
.match('/service-worker.js', ({ serviceWorker }) => {
return serviceWorker('.next/static/service-worker.js')
})
.use(nextRoutes)
.fallback(({ proxy }) => proxy('legacy'))
Documented here:
https://docs.layer0.co/guides/next#section_nextroutes_middleware