forward和redirect

1. From the address bar displays for  
forward server resource requests, direct access to the target address of the server URL , put the URL response content to read over, and then re-distributed to the content browser. Browser did not know sent by the server content came from, so it's address bar or the original address. 
redirect server is based on logic, send a status code that tells the browser to re-request the address, so the address bar shows the new the URL of .forward internal redirect, redirect external redirect
 2. from the data sharing for  
forward: forward page forward and page to share request to the data inside. 
redirect:. You can not share data 3. use where it 
forward: for general users when landing, depending on the role forwarded to the appropriate module. 
redirect: generally used to return the main page and jump to other sites when the user logs off landing, etc. 4. from the efficiency it 
forward: high. 
redirect:. low essential difference explained One
 
 



  
In short, the forwarding server behavior, redirect the client behavior. Why do you say, this workflow depends on two actions: 
forwarding process: the client browser sends an http request ---- "web server accepted the request -" a method call is completed within the interior of the container and request processing forwarding action ---- "sending resources to target customers; here, url forwarding path must be under the same web container, it can not turn to other web path up the middle passed a request within its own container . In the client browser bar displays the path is still its first path access, which means customers do not feel a forwarding server. Forwarding behavior is only a browser to access requests. 

Redirection procedure: the client browser to send an http request ---- "to 302 and the corresponding response status code to a new location after the client browser receiving a web server -" client browser 302 in response to a discovery, and then automatically sends a new the http request , the request url is the address of the new location ---- "server based on the request sent to the customer to find resources. Here location can be redirected to any URL, the browser since it is re-issued the request, the request would have no concept of the transfer. In the client browser displays the path bar to redirect its path, customers can observe the change of address. Redirect the browser to do a behavior is at least twice the access request. Interpretation II  
redirection, in fact, twice request, for the first time , the client request A, the server responds, and the response came back, telling the browser, you should go to B. This time IE

We can see the address has changed, but the history of the back button are bright. Redirection can access resources outside their own web applications. In the redirection process, the transmission of information will be lost.
Explain the three 
Suppose you go to apply for a license, 
redirection: you go to the office A, A person bureau, said: "This matter is not under our control, go to the office B", then you back out from A, himself B bus to the office. 
Forward: You go to the office A, A bureau looked after, should know the fact of the matter B Bureau to manage, but he did not return to you, but to make you sit for a while, back to their own people contacted the office of B, let them run after, sent over

Guess you like

Origin www.cnblogs.com/yz123/p/11950147.html