* 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:
parent
9a0c044884
commit
903713e705
2 changed files with 4 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue