Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: cache files for an hour

Brad Barbine16cc4f549ba
diff --git a/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx b/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx
index 2dcf2ea252..e8fa9ea001 100644
--- a/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx
+++ b/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx
@@ -41,6 +41,9 @@ export let loader = async ({ request, params }: LoaderFunctionArgs) => {
throw new Error("Failed to load file");
}
- const headers = new Headers({ "Content-Type": contentType });
+ const headers = new Headers({
+ "Content-Type": contentType,
+ "Cache-Control": "public, max-age=3600", // Cache for 1 hour
+ });
return new Response(result.data, { status: 200, headers });
};