Adding a prefix to routes in Strapi v3 doesn't work

67 Views Asked by At

I am using Strapi v3 as a headless CMS for our application. Currently, the admin portal can be accessed via the /admin route, and other pages can be reached directly using their respective route names.

Now, I want to add a prefix like /cms before all routes to make the URLs more consistent, e.g. /cms/admin for the admin portal and so on. However, when I tried to do this by modifying the config/server.js file, the admin page gets stuck on an indefinite loading spinner.

Here's the code I added to config/server.js:

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 8000),
  url: '/cms', // <------------ added prefix here 
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET'),
    },
  },
});

The issue seems similar to what was discussed in this comment on GitHub: https://github.com/strapi/strapi/issues/8487#issuecomment-740643751.

enter image description here

I would appreciate any help from experienced Strapi developers who have encountered and resolved this issue before. Please let me know if there's a proper way to add a prefix to all routes without causing issues with the admin page. Thank you in advance for your assistance!

0

There are 0 best solutions below