• Venat0r@lemmy.world
        link
        fedilink
        arrow-up
        6
        ·
        18 hours ago

        Hmm… Maybe using IP addresses like we use phone numbers? 😅

        That seems worse though 😅

            • wabasso@lemmy.ca
              link
              fedilink
              English
              arrow-up
              1
              ·
              edit-2
              2 hours ago

              Ok I RTFM but I’m still lost. Partly I don’t know enough about headers to understand the -H flag, but also:

              What provides the new location to curl when the attempt fails? The web server of the site at the IP you specified?

              How does one obtain the IP in the first place, I thought this discussion was about alternatives to DNS.

              • Lucy :3@feddit.org
                link
                fedilink
                arrow-up
                1
                ·
                1 hour ago

                -L, because I only specify 30p87.de, and the webserver will therefore redirect me to https://30p87.de/ with a 308 response. With -L, curl follows that automatically. -k, because I don’t have a cert for the IPv6, and the underlying SSL lib won’t like that. So -k forces it to ignore all issues with it, including the cert not having that IP as Alt name. -H “Host: 30p87.de”, because http servers serve you content not dependent on the IP you used, but the host you accessed (so that you can just have a.org, b.org and c.org served on the same IP, machine and port. And the host is read from the Host header. Curl sets that to the host you’re accessing, which is my IP, in this case. As my webserver doesn’t have an entry for that Host (because you’d never use an IP like that), it will fail. So to actually get the content of a webpage, I need to specify the Host manually.

                You obtain it by asking me, then memorizing, as the comment I responded to said. And I used an IPv6 address, because that’s even harder to remember.

                So: curl requests content from the webserver at my IP, for the host 30p87.de, just as it would with only curl 30p87.de . The webserver returns a 308 Permanent Redirect to https://30p87.de/, which curl automatically follows with the -L flag, and therefore does a new request on the same IP, but with the host https://30p87.de/, so essentially curl https://30p87.de/.