Skip to content

Commit 903713e

Browse files
jareddonovancatarak
authored andcommitted
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.
1 parent 9a0c044 commit 903713e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

server/server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ if (process.env.NODE_ENV === 'development') {
4545
corsOriginsWhitelist.push(/localhost/);
4646
}
4747

48+
app.set('trust proxy', true);
49+
4850
// Enable Cross-Origin Resource Sharing (CORS) for all origins
4951
const corsMiddleware = cors({
5052
credentials: true,

server/utils/previewGeneration.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ function resolveLinksInString(content, files, projectId) {
2929
while (resolvedFilePath.startsWith('/')) {
3030
resolvedFilePath = resolvedFilePath.substr(1);
3131
}
32-
newContent = newContent.replace(filePath, `/sketches/${projectId}/assets/${resolvedFilePath}`);
32+
const replacement = `/sketches/${projectId}/assets/${resolvedFilePath}`;
33+
newContent = newContent.replace(filePath, replacement);
3334
}
3435
}
3536
}

0 commit comments

Comments
 (0)