fix(upload): send browser-like headers in from-url fetch (CDN 403s)
Publish container image / build-and-push (push) Canceled after 0s

This commit is contained in:
Niklas
2026-09-05 12:45:26 +02:00
parent c36ea81c29
commit 6587c3f865
+8 -1
View File
@@ -286,7 +286,14 @@ function downloadImage(imageUrl, maxRedirects = 5) {
const parsed = new URL(imageUrl);
const client = parsed.protocol === 'https:' ? https : http;
client.get(imageUrl, { timeout: 30000 }, (response) => {
// Browser-like headers: many CDNs (film.ai, frameset, etc.) reject
// requests without UA/Referer with 403.
const requestHeaders = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36",
"Accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
"Referer": parsed.origin + "/",
};
client.get(imageUrl, { timeout: 30000, headers: requestHeaders }, (response) => {
// Follow redirects up to maxRedirects times
if ([301, 302, 303, 307, 308].includes(response.statusCode) && response.headers.location) {
if (maxRedirects <= 0) {