[BUG] BackingImage does not download URL correctly in some situation #7914
Labels
area/backing-image
Backing image related
backport/1.5.4
backport/1.6.1
kind/bug
require/auto-e2e-test
Require adding/updating auto e2e test cases if they can be automated
require/backport
Require backport. Only used when the specific versions to backport have not been definied.
require/qa-review-coverage
Require QA to review coverage
Milestone
Describe the bug
This issue refers to harvester/harvester#5126
When a backing image is created from URL, e.g. an ISO hosted on SourceForge, then the ISO is not downloaded, instead the HTML code of the download page is downloaded.
This is because the Go http client is automatically adding the
Referer
header on each request. For retrieving documents with server-side processing that assume they are always being retrieved by interactive web browsers and only come out properly whenReferer
is set to one of the pages that point to them this is a correct behaviour. But as explained below, this seems not the default behaviour of well-known tools.To Reproduce
Create a backing image with
Download from URL
using URLhttps://sourceforge.net/projects/clonezilla/files/clonezilla_live_alternative/20240116-mantic/clonezilla-live-20240116-mantic-amd64.iso
. The file is download, but not the 500 MiB ISO, instead the HTML code of the download page which is about 100 KiB.Expected behavior
The ISO should be downloaded, not the HTML code of the download page.
The default behaviour of the Go http client should be overwritten, so that the
Referer
header is not sent.The well known tools
wget
andcurl
behave different to the Go http client. You need to explicitly enable theReferer
behaviour for both tools. Out-of-the-box both can download the mentioned ISO without problems.Support bundle for troubleshooting
n/a
Environment
Vagrant based Harvester cluster (developer environment) using Longhorn 1.6
Additional context
To understand why
curl
is able to download the ISO image, here is a condensed output of the download:As shown,
curl
does not send aReferer
header, even when following theLocation
header on redirects.Cross-check... make
curl
automatically set the previous URL when it follows aLocation
header.This will download the HTML download page only, not the ISO file.
wget
will also download the ISO by default, e.g. withTest case
Setting > Backing Image
and pressCreate Backing Image
.https://sourceforge.net/projects/clonezilla/files/clonezilla_live_alternative/20240116-mantic/clonezilla-live-20240116-mantic-amd64.iso
as URL and pressOK
.The text was updated successfully, but these errors were encountered: