opened 07:01AM - 05 Feb 24 UTC
closed 08:06AM - 05 Feb 24 UTC
flag: question
<!--
Hello 👋 Thank you for submitting an issue.
Before you start, please mak…e sure your issue is understandable and reproducible.
To make your issue readable make sure you use valid Markdown syntax.
https://guides.github.com/features/mastering-markdown/
Please ensure you have also read and understand the contributing guide.
https://github.com/strapi/strapi/blob/main/CONTRIBUTING.md#reporting-an-issue
-->
## 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
1. Create Middleware for Redirection from /admin to admin/content-manager/collection-types/api::api-name.api-name
2. Login to /admin using admin/editor credentials
3. 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);
};**
4. Successfull login user should get redirected to **/admin/content-manager/collectionType/api::api-name.api-name** page.
5. 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.