Skip to content

Commit

Permalink
Merge pull request #233 from cbh6/master
Browse files Browse the repository at this point in the history
Allow config header Access-Control-Allow-Origin on LocalServer module
  • Loading branch information
darqs authored Jul 17, 2019
2 parents 4b26f11 + e12ae0c commit df86954
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions scaffold/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"webAppStartupTimeout": 60000,
"exposeLocalFilesystem": false,
"allowOriginLocalServer": false,
"window": {
"icon": "@assets/meteor.png",
"_windows": {
Expand Down
5 changes: 4 additions & 1 deletion skeleton/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,10 @@ export default class App {
settings = this.prepareAutoupdateSettings();
}
if (internal && moduleName === 'localServer') {
settings = { localFilesystem: this.settings.exposeLocalFilesystem };
settings = {
localFilesystem: this.settings.exposeLocalFilesystem,
allowOriginLocalServer: this.settings.allowOriginLocalServer || false
};
}

this.modules[moduleName] = new AppModule({
Expand Down
4 changes: 4 additions & 0 deletions skeleton/modules/localServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ export default class LocalServer {
return next();
}

if (self.settings.allowOriginLocalServer) {
res.setHeader('Access-Control-Allow-Origin', '*');
}

const bareUrl = parsedUrl.pathname.substr(urlAlias.length);

let filePath;
Expand Down

0 comments on commit df86954

Please sign in to comment.