[CentOS-devel] MirrorManager link redirect issue

Wed Nov 10 19:46:56 UTC 2021
František Šumšal <frantisek at sumsal.cz>

On 11/10/21 18:40, Mike Rochefort wrote:
> I just had a merge request[0] pulled into the osinfo-db project that
> adds CentOS Stream 9 details. This is used by tools like GNOME Boxes
> to discover and download ISOs as well as configure generic VM
> information. The MR stems from a user reporting Boxes wasn't listing
> Stream 9 as an available option.
> As part of the process I had to provide direct URLs to the Stream 9
> ISOs. I would have preferred to have used the MirrorManager links,
> such as:
> https://mirrors.centos.org/mirrorlist?path=/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-dvd1.iso&redirect=1&protocol=https
> But these URLs don't redirect properly with tools like wget or curl,
> instead returning a list of available mirror links to download from.
> It works just fine in a browser, maybe I don't know the proper flags
> to pass to make this work as expected. Currently the base URL used is
> from the mirror.stream.centos.org site.

I guess using the `-L` option for curl should do the trick:

$ curl -JLO "https://mirrors.centos.org/mirrorlist?path=/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-dvd1.iso&redirect=1&protocol=https"

as for wget, it follows redirects automagically, but you can add
`--content-disposition` into the mix to get the "correct" filename:

$ wget --content-disposition "https://mirrors.centos.org/mirrorlist?path=/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-dvd1.iso&redirect=1&protocol=https"
--2021-11-10 18:57:03--  https://mirrors.centos.org/mirrorlist?path=/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-dvd1.iso&redirect=1&protocol=https
Resolving mirrors.centos.org (mirrors.centos.org)...,,, ...
Connecting to mirrors.centos.org (mirrors.centos.org)||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://mirror.netsite.dk/centos-stream/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-dvd1.iso [following]
--2021-11-10 18:57:03--  https://mirror.netsite.dk/centos-stream/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-dvd1.iso
Resolving mirror.netsite.dk (mirror.netsite.dk)..., 2a0c:cc00:0:1604::1
Connecting to mirror.netsite.dk (mirror.netsite.dk)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8299479040 (7.7G) [application/octet-stream]
Saving to: ‘CentOS-Stream-9-latest-x86_64-dvd1.iso’

CentOS-Stream-9-latest-x86_64-dvd1.iso                        0%[


> Is there a way to make the MM links work, or is pointing to the CentOS
> mirror alright for this?
> [0] https://gitlab.com/libosinfo/osinfo-db/-/merge_requests/366
> --
> Mike Rochefort
> _______________________________________________
> CentOS-devel mailing list
> CentOS-devel at centos.org
> https://lists.centos.org/mailman/listinfo/centos-devel

PGP Key ID: 0xFB738CE27B634E4B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos-devel/attachments/20211110/5f70a603/attachment-0003.sig>