WIP - Mixed content error for Issue #543 (#661)

* Set trust proxy option on Express app.

* Fix replacement of filePath for full screen and embed sketches.

* Use const rather than let because  is never reassigned.
This commit is contained in:
Jared Donovan 2018-07-04 06:02:46 +10:00 committed by Cassie Tarakajian
parent 9a0c044884
commit 903713e705
2 changed files with 4 additions and 1 deletions

View file

@ -45,6 +45,8 @@ if (process.env.NODE_ENV === 'development') {
corsOriginsWhitelist.push(/localhost/);
}
app.set('trust proxy', true);
// Enable Cross-Origin Resource Sharing (CORS) for all origins
const corsMiddleware = cors({
credentials: true,

View file

@ -29,7 +29,8 @@ function resolveLinksInString(content, files, projectId) {
while (resolvedFilePath.startsWith('/')) {
resolvedFilePath = resolvedFilePath.substr(1);
}
newContent = newContent.replace(filePath, `/sketches/${projectId}/assets/${resolvedFilePath}`);
const replacement = `/sketches/${projectId}/assets/${resolvedFilePath}`;
newContent = newContent.replace(filePath, replacement);
}
}
}