Why is there a difference between forwarding and redirection

Why is there a difference between normal forwarding and redirection? Think about it with this question:

 

benefit

Let me talk about the conclusion first, the benefits that redirection can bring:

  1.   The website requires users to log in before they can access the homepage, such as Zhihu. Otherwise, you have been on the login page. If there is no such redirection, you can manually change the URL to access other "resources" that are not easily accessible (PS: I tried this personally, when I visited the University of Auckland website)
  2. When logging in to the page, if you use get and post requests (ie get first and then post format , get is the user enters the login page, and post is the user submits the login data, such as user name, email, password, etc.) to log in (login logic) Generally check the data, query the database, and enter the homepage if it is correct), and if you do not use redirection, refresh the browser again, you will see a pop-up warning above ( requires confirmation before submitting the form again ), because the last time is a post request , Refresh will submit data (data submitted on the login page) this time, we don’t want this to happen. So the general login logic of current websites is get/redirect/post format. ps: I learned this while studying "Flask web development".
  3.  Ordinary request/forwarding can generally only access the resources on the site, while redirection can access other site resources (you can also access your own site resources).
  4. Prevent web crawlers to a certain extent. Websites can be redirected multiple times for disgusting crawlers , especially to prevent headless browsers or simulated browsers.

At present, only 4 points can be understood, and other benefits will continue to be added later. . . . . . . . . . . . .

 

The difference between normal forwarding and redirection

1 Ordinary forwarding is just a request and response for the "Boss" of the browser. "Boss" doesn't care about how many things are done in the middle. The boss is very idle.

2 Redirection For the "Boss" of the browser, it is like a personal secretary. Everything needs to be signed by the "Boss". The secretary will often report to the boss, so at least two requests and responses are required. The boss is very busy.

Guess you like

Origin blog.csdn.net/qq_39463175/article/details/111502596