mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
Fix/admin path serve (#5287)
* Add config option to disable serving admin assets Signed-off-by: Jozef Cipa <cipa.jozef@gmail.com> * Add serveAdminPanel option to docs Signed-off-by: Jozef Cipa <cipa.jozef@gmail.com> * Inherit default value for serving admin from config Signed-off-by: Jozef Cipa <cipa.jozef@gmail.com>
This commit is contained in:
parent
b2d19c8ad8
commit
e8c4629779
@ -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.
|
## 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": {
|
"admin": {
|
||||||
"path": "/", // Note: The administration will be accessible from the root of the domain (ex: http//yourfrontend.com/)
|
"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": {
|
"build": {
|
||||||
"backend": "http://yourbackend.com"
|
"backend": "http://yourbackend.com"
|
||||||
}
|
}
|
||||||
|
10
packages/strapi/lib/core/bootstrap.js
vendored
10
packages/strapi/lib/core/bootstrap.js
vendored
@ -344,6 +344,16 @@ module.exports = function(strapi) {
|
|||||||
'admin'
|
'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();
|
strapi.config.admin.url = new URL(adminPath, strapi.config.url).toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user