Skip to content

Commit

Permalink
feat: make asset proxy permanent (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjschill87 committed Feb 14, 2024
1 parent a83f493 commit 9ff8c93
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions tooling/helium-server/worker/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ async function handleSsr(url, authToken = null, userAndAppearanceToken = null) {
} else {
const { statusCode, body } = httpResponse;
const headers = assembleHeaders(pageContext);
const resBody =
HELIUM_PRIVATE_ENABLE_ASSET_PROXY === 'true' ? body : resolveAssetUrls(url, body);

return new Response(resBody, {
return new Response(body, {
headers,
status: statusCode
});
Expand Down Expand Up @@ -89,15 +87,6 @@ function decryptUserAndAppearance(userAndAppearanceToken, tiInstance) {
return { currentUser, appearanceBlock };
}

function resolveAssetUrls(url, htmlString) {
const urlObj = new URL(url);
const resolvedString = htmlString.replace(
/ (src|href)="\/assets\/(.*?)"/g,
` $1="${urlObj.origin}/assets/$2"`
);
return resolvedString;
}

function assembleHeaders(pageContext) {
const headers = { 'content-type': 'text/html' };

Expand Down

0 comments on commit 9ff8c93

Please sign in to comment.