From ce1628cd6964a625963fa03dd7ed4754e50620a5 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Fri, 10 Apr 2020 18:30:07 -0400 Subject: [PATCH] Fixes #1268 - fix issue with default protocol of https for local development --- server/controllers/embed.controller.js | 2 +- server/routes/asset.routes.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/controllers/embed.controller.js b/server/controllers/embed.controller.js index 644a3441..67edcd04 100644 --- a/server/controllers/embed.controller.js +++ b/server/controllers/embed.controller.js @@ -25,7 +25,7 @@ export function serveProject(req, res) { const sketchDoc = window.document; const base = sketchDoc.createElement('base'); - const fullUrl = `https://${req.get('host')}${req.originalUrl}`; + const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`; base.href = `${fullUrl}/`; sketchDoc.head.appendChild(base); diff --git a/server/routes/asset.routes.js b/server/routes/asset.routes.js index db593b6d..ab3f52a0 100644 --- a/server/routes/asset.routes.js +++ b/server/routes/asset.routes.js @@ -7,9 +7,10 @@ const router = new Router(); router.get('/:username/sketches/:project_id/*', getProjectAsset); router.get('/full/:project_id/*', getProjectAsset); router.get('/:username/full/:project_id/*', getProjectAsset); +router.get('/present/:project_id/*', getProjectAsset); +router.get('/:username/present/:project_id/*', getProjectAsset); router.get('/embed/:project_id/*', getProjectAsset); router.get('/:username/embed/:project_id/*', getProjectAsset); -router.get('/:username/present/:project_id/*', getProjectAsset); router.get('/sketches/:project_id/assets/*?', getFileContent);