Hi James,
apt-archive.p.o is hosted via an AWS S3 bucket which doesn't include/generate
index lists (e.g, index.html) which is why [1] doesn't work. If you are
familiar with the structure of Debian repos, you can view the repo's index by
browsing the appropriate files directly. For example,
https://apt-archive.postgresql.org/pub/repos/apt/dists/${DISTRIBUTION}-pgdg-archive/InRelease
where distribution is bullseye, focal, etc. The "InRelease" file will contain
paths for various "Packages" files. You can view the list of packages by
replacing "InRelease" with the appropraite package path. For example
https://apt-archive.postgresql.org/pub/repos/apt/dists/${DISTRIBUTION}-pgdg-archive/main/binary-amd64/Packages
Using this, we can see why [2] isn't working for you -- there is no libpq-dev
in bullseye-pgdg-archive, the package is libpq5-dev.
Hope this helps somewhat.
--Bradford