Skip to content

Commit

Permalink
Merge branch 'remix-run:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jul 10, 2024
2 parents 0c3c2fd + bbead33 commit 5ab5afd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- abotsi
- accidentaldeveloper
- achinchen
- acusti
- adamwathan
- adicuco
- AdiRishi
Expand Down
12 changes: 4 additions & 8 deletions templates/cloudflare-workers/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ const handleRemixRequest = createRequestHandler(remixBuild);

export default {
async fetch(request, env, ctx) {
const waitUntil = ctx.waitUntil.bind(ctx);
const passThroughOnException = ctx.passThroughOnException.bind(ctx);
try {
const url = new URL(request.url);
const ttl = url.pathname.startsWith("/assets/")
? 60 * 60 * 24 * 365 // 1 year
: 60 * 5; // 5 minutes
return await getAssetFromKV(
{
request,
waitUntil: ctx.waitUntil.bind(ctx),
},
{ request, waitUntil },
{
ASSET_NAMESPACE: env.__STATIC_CONTENT,
ASSET_MANIFEST: MANIFEST,
Expand All @@ -40,10 +39,7 @@ export default {
// `cloudflareDevProxyVitePlugin`:
// https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy
cf: request.cf,
ctx: {
waitUntil: ctx.waitUntil,
passThroughOnException: ctx.passThroughOnException,
},
ctx: { waitUntil, passThroughOnException },
caches,
env,
},
Expand Down

0 comments on commit 5ab5afd

Please sign in to comment.