When using split cookies to have different cookie name for the shop-api and the admin-api, we used to apply the cookieSession() middleware globally.
However, Nest Global Middlewares can't be applied to specific routes.
By doing Global Middlewares, the last applied app.use() middleware was overriding the above-mentioned ones.
As a consequence, for the case when the user wants to split the cookies, we do not do it in the bootstrap() function any longer but instead we do it in the AppModule.configure() method, where other middlewares route-specific are already applied.
Breaking changes
There is no breaking change as we just fix a behaviour that was not working.
Description
When using split cookies to have different cookie name for the
shop-api
and theadmin-api
, we used to apply thecookieSession()
middleware globally.However, Nest Global Middlewares can't be applied to specific routes. By doing Global Middlewares, the last applied
app.use()
middleware was overriding the above-mentioned ones.Instead, we have to use Functional Middlewares for the specific paths we like.
As a consequence, for the case when the user wants to split the cookies, we do not do it in the
bootstrap()
function any longer but instead we do it in theAppModule.configure()
method, where other middlewares route-specific are already applied.Breaking changes
There is no breaking change as we just fix a behaviour that was not working.
Screenshots
N/A
Checklist
π Always:
π Most of the time: