Académique Documents
Professionnel Documents
Culture Documents
(/)
HTTP Gallery
Jump to ...
7. Redirection
HTTP allows servers to redirect a client request to a dierent location. Although, this will usually result in another network round trip, it has
some useful applications:
A web application may use redirection to navigate between parts of the application.
If content has moved to a dierent URL or domain name, redirection can be used to avoid breaking old URLs or bookmarks.
A client can be directed to use its local cache for content that has not changed.
301 This indicates that the content now resides permanently at the location specied by the Location header and future requests should be
directed to this location.
302 Same as 301, except that the new location is temporary and future requests should still be sent to the original location. Another feature
of this status code is that if the original request was a POST the client will change to using a GET when it re-issues the request (See
below for more details).
303 This status code was intended to be the only status code that caused a POST to be converted to a GET. However, most browsers treat a
302 like a 303.
304 Used in response to an If-Modied header to redirect a request to the browser's local cache.
305 A 305 response is used to specify that a request must be resubmitted through the HTTP proxy in the Location header
https://www.httpwatch.com/httpgallery/redirection/ 1/3
7/4/2017 HTTPRedirection|HttpWatch
These problems can be avoided by redirecting the result of a POST to a GET using a 302 status code. (See the example below)
Example 7
Redirecting a POST
This is one of the samples from Example 6 that has been modied to redirect the result of the POST request. If you refresh this page after
modifying the account balance, there is no retry message box displayed and the account balance will not change:
1. Open HttpWatch by right clicking on the web page and selecting HttpWatch from the context menu
4. You'll see a POST 302 entry that redirects to a GET on this page.
(/DOWNLOAD/)
BUY NOW (/BUY/)
https://www.httpwatch.com/httpgallery/redirection/ 2/3
7/4/2017 HTTPRedirection|HttpWatch
HttpWatch
Features (/features/httpdebugger.aspx)
Compare Editions (/editions.aspx)
New in Version 10.x (/newin10x.aspx)
Download (/download/)
Pricing (/buy/)
Our Customers
Who is using it? (/#customers)
What are they saying? (/#quotes)
Support
Technical Support (/support/)
About Us (/company/)
Contact Us (/company/)
Blog (http://blog.httpwatch.com)
Twitter (https://twitter.com/httpwatch)
Search (/search/) Terms & Conditions (/company/terms.aspx) Privacy Policy (/company/privacy_policy.aspx) Copyright (/company/copyright.aspx)
https://www.httpwatch.com/httpgallery/redirection/ 3/3