Moved members static mount point to /ghost/members
no-issue This alleviates the CORS requests failing for members when the admin is hosted on a different domain than the site
This commit is contained in:
parent
bb1ee3c265
commit
0e2ce29468
@ -1 +1 @@
|
||||
MembersThemeBindings.init({ssrUrl: "{{blog-url}}/members/ssr", membersUrl: "{{blog-url}}/members"});
|
||||
MembersThemeBindings.init({ssrUrl: "{{blog-url}}/members/ssr", membersUrl: "{{admin-url}}/members"});
|
||||
|
@ -45,13 +45,13 @@ module.exports = function setupParentApp(options = {}) {
|
||||
// @TODO: finish refactoring the API app
|
||||
parentApp.use('/ghost/api', require('./api')());
|
||||
|
||||
// MEMBERS
|
||||
parentApp.use('/ghost/members', labs.members, membersService.gateway);
|
||||
parentApp.use('/ghost/members/auth', labs.members, membersService.authPages);
|
||||
|
||||
// ADMIN
|
||||
parentApp.use('/ghost', require('./admin')());
|
||||
|
||||
// MEMBERS
|
||||
parentApp.use('/members', labs.members, membersService.gateway);
|
||||
parentApp.use('/members/auth', labs.members, membersService.authPages);
|
||||
|
||||
// BLOG
|
||||
parentApp.use(require('./site')(options));
|
||||
|
||||
|
@ -9,6 +9,7 @@ function createPublicFileMiddleware(file, type, maxAge) {
|
||||
const publicFilePath = config.get('paths').publicFilePath;
|
||||
const filePath = file.match(/^public/) ? path.join(publicFilePath, file.replace(/^public/, '')) : path.join(publicFilePath, file);
|
||||
const blogRegex = /(\{\{blog-url\}\})/g;
|
||||
const adminRegex = /(\{\{admin-url\}\})/g;
|
||||
const apiRegex = /(\{\{api-url\}\})/g;
|
||||
|
||||
return function servePublicFile(req, res, next) {
|
||||
@ -26,6 +27,7 @@ function createPublicFileMiddleware(file, type, maxAge) {
|
||||
if (type === 'text/xsl' || type === 'text/plain' || type === 'application/javascript') {
|
||||
str = str.replace(blogRegex, urlUtils.urlFor('home', true).replace(/\/$/, ''));
|
||||
str = str.replace(apiRegex, urlUtils.urlFor('api', {cors: true, version: 'v0.1', versionType: 'content'}, true));
|
||||
str = str.replace(adminRegex, urlUtils.urlFor('admin', true).replace(/\/$/, ''));
|
||||
}
|
||||
|
||||
content = {
|
||||
|
Loading…
Reference in New Issue
Block a user