-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Description
Bug report
Required System information
- Node.js version: 20.10.0
- NPM version:10.2.5
- Strapi version:4.19.1
- Database:Postgres
- Operating system:Windows
- Is your project Javascript or Typescript: Javascript
Describe the bug
Middleware created for redirecting user from /admin to custom page is not working in 4.19.1Version
Steps to reproduce the behavior
- Create Middleware for Redirection from /admin to admin/content-manager/collection-types/api::api-name.api-name
- Login to /admin using admin/editor credentials
- Once we add below code in middleware created for root of library
**'use strict';
/**
redirect` middleware
*/
module.exports = (config, { strapi }) => {
const redirects = ["/", "/index.html", "/admin", "/admin/auth/login"].map((path) => ({
method: "GET",
path,
handler: (ctx) => ctx.redirect("/admin/content-manager/collectionType/api::api-name.api-name"),
config: { auth: false },
}));
strapi.server.routes(redirects);
};**
-
Successfull login user should get redirected to /admin/content-manager/collectionType/api::api-name.api-name page.
-
Page is still loading with welcome screen, but when user refreshes the page screen is loading as expected. This is working fine in 4.16.2 version.
Expected behavior
Once user logs in user should see the collection type/ content manager screen as per code in middleware. This is working fine in 4.16.2 version.
Code snippets
'use strict';
/**
redirect` middleware
*/
module.exports = (config, { strapi }) => {
const redirects = ["/", "/index.html", "/admin", "/admin/auth/login"].map((path) => ({
method: "GET",
path,
handler: (ctx) => ctx.redirect("/admin/content-manager/collectionType/api::api-name.api-name"),
config: { auth: false },
}));
strapi.server.routes(redirects);
};
Additional context
This is working fine in 4.16.2.