optimized bootstrapper script download

This commit is contained in:
Oliver Kieselbach
2026-02-18 16:06:29 +01:00
parent 5341bab665
commit 9b29940666
2 changed files with 29 additions and 1 deletions
@@ -0,0 +1,28 @@
const BOOTSTRAPPER_URL =
"https://autopilotmonitor.blob.core.windows.net/agent/Install-AutopilotMonitor.ps1";
export const runtime = "nodejs";
export async function GET() {
try {
const upstream = await fetch(BOOTSTRAPPER_URL, { cache: "no-store" });
if (!upstream.ok || !upstream.body) {
return Response.redirect(BOOTSTRAPPER_URL, 302);
}
const headers = new Headers();
headers.set("Content-Type", "application/octet-stream");
headers.set(
"Content-Disposition",
'attachment; filename="Install-AutopilotMonitor.ps1"',
);
headers.set("Cache-Control", "public, max-age=300");
return new Response(upstream.body, {
status: 200,
headers,
});
} catch {
return Response.redirect(BOOTSTRAPPER_URL, 302);
}
}
@@ -211,7 +211,7 @@ function SectionAgentSetup() {
Download the PowerShell script that installs and configures the Autopilot Monitor agent:
</p>
<a
href="https://autopilotmonitor.blob.core.windows.net/agent/Install-AutopilotMonitor.ps1"
href="/api/download/bootstrapper"
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-lg transition-colors"