diff --git a/docs/3.0.0-beta.x/admin-panel/deploy.md b/docs/3.0.0-beta.x/admin-panel/deploy.md index 1c77b7a643..09d324608d 100644 --- a/docs/3.0.0-beta.x/admin-panel/deploy.md +++ b/docs/3.0.0-beta.x/admin-panel/deploy.md @@ -28,7 +28,7 @@ You might want to change the path to access to the administration panel. Here th } ``` -**You have to rebuild the administration panel to make this work.** [Build instructions](#build). +**You have to rebuild the administration panel to make this work.** [Build instructions](./customization.md#build). ## Deploy the administration panel on another server (AWS S3, Azure, etc) than the API. @@ -45,6 +45,7 @@ It's very common to deploy the front-end and the back-end on different servers. }, "admin": { "path": "/", // Note: The administration will be accessible from the root of the domain (ex: http//yourfrontend.com/) + "serveAdminPanel": false, // http://yourbackend.com will not serve any static admin files "build": { "backend": "http://yourbackend.com" } diff --git a/packages/strapi/lib/core/bootstrap.js b/packages/strapi/lib/core/bootstrap.js index d779715400..83f9e11cc5 100644 --- a/packages/strapi/lib/core/bootstrap.js +++ b/packages/strapi/lib/core/bootstrap.js @@ -344,6 +344,16 @@ module.exports = function(strapi) { 'admin' ); + // check if we should serve admin panel + const shouldServeAdmin = _.get( + strapi.config.currentEnvironment.server, + 'admin.serveAdminPanel', + strapi.config.serveAdminPanel + ); + if (!shouldServeAdmin) { + strapi.config.serveAdminPanel = false; + } + strapi.config.admin.url = new URL(adminPath, strapi.config.url).toString(); };