I am trying to send a request, but with some sites I always get a 301 Moved Permanently statue. Why it happens?
telnet habrahabr.ru 80 GET / HTTP/1.1 Host: habrahabr.ru I am trying to send a request, but with some sites I always get a 301 Moved Permanently statue. Why it happens?
telnet habrahabr.ru 80 GET / HTTP/1.1 Host: habrahabr.ru The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .
if you opened the browser console (and not telnet), the network tab, you would see that habrahabr.ru redirects to the https version of the site.
this is one of the reasons why the sites redirect, from others the site moves out of the domain and / or the domain is no longer used for http / https traffic, the crazy admin was unable to configure anything, etc. There may be many reasons, but the first (redirect from http to https) is the most common for large sites.
I doubt that you will be able to browse sites with only the https version through telnet, you need to be able to or VERY QUICKLY PRINT , or use something like curl / python / php / any other programming language / ... browser.
For those beginners who want to learn how the http protocol works (very simple) and how to debug it - I advise you to score on this matter and study the work of http2
telnet to try to connect to https ? - jisecayeyotelnet habrahabr.ru 443 (443 is the https port, browsers automatically access it when they see https in the link) - strangeqargoThis happens because the owners of the server want it so much. Code 301 means that the content has been moved and its new location is transferred in the Location parameter. The browser, having received the answer 301 should move to a new location.
It should be noted that 301 means not just "moved", but "moved forever." When re-requesting the original address, the browser may not even contact the server, but immediately request a document from the new location. There is code 302, which means "moved temporarily." This browser transition address is not necessary to remember.
Location . But in the case of Habr, you will not succeed - there is SSL, and you can’t do it in telnet . - user194374Source: https://ru.stackoverflow.com/questions/555152/
All Articles