Is there still a use case for HTTP 301 rather than HTTP 308 to indicate that a resource has moved...












0














I am specifying a ReST service. I recently stumbled on this IETF draft document which could be interpreted as suggesting that ReST services should always return 308. Note that the document seems to have expired without being superseded (I'm not very clear on the IETF process).



I had it in my mind earlier that a service should return "301 Moved Permanently" for a GET and a "308 Permanent Redirect" for a POST to ensure it is not inappropriately converted to a GET (by something trying to be clever).



Uses of both 301 and 308 seem to be expressed in terms of SHOULDs and SHOULD NOTs rather than MUSTs and MUST NOTs, so it is unclear what "the right thing" is philosphically.



Pragmatically 301 for GET and 308 for POST should work.
308 for GET is not wrong as the current revision at the time of writing includes an example of 308 being produced in response to a GET.
Now there is a deployment concern that if a client doesn't understand 308 it should treat it like a 300 (rather than a 301 which makes more sense to me) but 308 is now widely understood so the question becomes if or why should you ever use HTTP 301?



If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1? Is there a legitimate use case for converting a POST into a GET for a redirect in ReST or in more generally in HTTP?



For 301 HTTP/1.1 says:




Note: For historical reasons, a user agent MAY change the request
method from POST to GET for the subsequent request.




Why was that ever a good idea? Is it still valid anywhere?



See also:





  • What's difference between HTTP 301 and 308 status codes?
    which provides good coverage of the difference between 301 and 308 but does not cover this point.

  • How should client of Restful API handle http status 301 redirect upon POST?

  • What's the deal with HTTP status code 308?










share|improve this question
























  • tools.ietf.org/html/rfc7538 Generally it's your (design) decision. As in your example there would not be a huge difference. But if you standardize it, you would not need to worry about different cases. Just ask yourself is there a downside using the newer 308 over the old 301? If not use the newer one.
    – Tom-Oliver Heidel
    Nov 22 at 23:25












  • My hope is that with a well defined protocol like HTTP we can move towards designs where there is one right way to do things. In this case I think its 308 (I'm asking 'the internet' why I'm wrong - or possibly right) but if 308 is a bugfix for 301 why didn't the IETF deprecate 301. Does 301 still have a sensible use case separate from 308?
    – Bruce Adams
    Nov 23 at 9:39










  • 308 is not a bug fix. It's rather an extension to secure that the same method will be used (e.g. POST -> POST). How a program or browser reacts to it depends on the implementation. 301 won't deprecate that fast. 308 is there to add another layer of protection/security into the protocol.
    – Tom-Oliver Heidel
    Nov 23 at 14:19










  • How a client should interpret status codes is mostly covered in the standard so its not implementation dependent. If I returned a 400 for a resource that does not exist instead of 404 I would be wrong. There are systems, including "ReSTish" APIs that do not follow the standard properly. There are may be a few ambiguities (301/308 possibly being one). 301 won't disappear from implementations overnight. The question is does 308 make it redundant? (if so the right thing is to always use 308 and label 301 as deprecated).
    – Bruce Adams
    Nov 23 at 14:32










  • Why was that ever a good idea? Is it still valid anywhere? If we are lucky enough, we may get some input from Julian Reschke who authored the RFC 7538 and co-authored the RFC 7231 with Fielding.
    – Cassio Mazzochi Molin
    Nov 23 at 15:13
















0














I am specifying a ReST service. I recently stumbled on this IETF draft document which could be interpreted as suggesting that ReST services should always return 308. Note that the document seems to have expired without being superseded (I'm not very clear on the IETF process).



I had it in my mind earlier that a service should return "301 Moved Permanently" for a GET and a "308 Permanent Redirect" for a POST to ensure it is not inappropriately converted to a GET (by something trying to be clever).



Uses of both 301 and 308 seem to be expressed in terms of SHOULDs and SHOULD NOTs rather than MUSTs and MUST NOTs, so it is unclear what "the right thing" is philosphically.



Pragmatically 301 for GET and 308 for POST should work.
308 for GET is not wrong as the current revision at the time of writing includes an example of 308 being produced in response to a GET.
Now there is a deployment concern that if a client doesn't understand 308 it should treat it like a 300 (rather than a 301 which makes more sense to me) but 308 is now widely understood so the question becomes if or why should you ever use HTTP 301?



If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1? Is there a legitimate use case for converting a POST into a GET for a redirect in ReST or in more generally in HTTP?



For 301 HTTP/1.1 says:




Note: For historical reasons, a user agent MAY change the request
method from POST to GET for the subsequent request.




Why was that ever a good idea? Is it still valid anywhere?



See also:





  • What's difference between HTTP 301 and 308 status codes?
    which provides good coverage of the difference between 301 and 308 but does not cover this point.

  • How should client of Restful API handle http status 301 redirect upon POST?

  • What's the deal with HTTP status code 308?










share|improve this question
























  • tools.ietf.org/html/rfc7538 Generally it's your (design) decision. As in your example there would not be a huge difference. But if you standardize it, you would not need to worry about different cases. Just ask yourself is there a downside using the newer 308 over the old 301? If not use the newer one.
    – Tom-Oliver Heidel
    Nov 22 at 23:25












  • My hope is that with a well defined protocol like HTTP we can move towards designs where there is one right way to do things. In this case I think its 308 (I'm asking 'the internet' why I'm wrong - or possibly right) but if 308 is a bugfix for 301 why didn't the IETF deprecate 301. Does 301 still have a sensible use case separate from 308?
    – Bruce Adams
    Nov 23 at 9:39










  • 308 is not a bug fix. It's rather an extension to secure that the same method will be used (e.g. POST -> POST). How a program or browser reacts to it depends on the implementation. 301 won't deprecate that fast. 308 is there to add another layer of protection/security into the protocol.
    – Tom-Oliver Heidel
    Nov 23 at 14:19










  • How a client should interpret status codes is mostly covered in the standard so its not implementation dependent. If I returned a 400 for a resource that does not exist instead of 404 I would be wrong. There are systems, including "ReSTish" APIs that do not follow the standard properly. There are may be a few ambiguities (301/308 possibly being one). 301 won't disappear from implementations overnight. The question is does 308 make it redundant? (if so the right thing is to always use 308 and label 301 as deprecated).
    – Bruce Adams
    Nov 23 at 14:32










  • Why was that ever a good idea? Is it still valid anywhere? If we are lucky enough, we may get some input from Julian Reschke who authored the RFC 7538 and co-authored the RFC 7231 with Fielding.
    – Cassio Mazzochi Molin
    Nov 23 at 15:13














0












0








0







I am specifying a ReST service. I recently stumbled on this IETF draft document which could be interpreted as suggesting that ReST services should always return 308. Note that the document seems to have expired without being superseded (I'm not very clear on the IETF process).



I had it in my mind earlier that a service should return "301 Moved Permanently" for a GET and a "308 Permanent Redirect" for a POST to ensure it is not inappropriately converted to a GET (by something trying to be clever).



Uses of both 301 and 308 seem to be expressed in terms of SHOULDs and SHOULD NOTs rather than MUSTs and MUST NOTs, so it is unclear what "the right thing" is philosphically.



Pragmatically 301 for GET and 308 for POST should work.
308 for GET is not wrong as the current revision at the time of writing includes an example of 308 being produced in response to a GET.
Now there is a deployment concern that if a client doesn't understand 308 it should treat it like a 300 (rather than a 301 which makes more sense to me) but 308 is now widely understood so the question becomes if or why should you ever use HTTP 301?



If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1? Is there a legitimate use case for converting a POST into a GET for a redirect in ReST or in more generally in HTTP?



For 301 HTTP/1.1 says:




Note: For historical reasons, a user agent MAY change the request
method from POST to GET for the subsequent request.




Why was that ever a good idea? Is it still valid anywhere?



See also:





  • What's difference between HTTP 301 and 308 status codes?
    which provides good coverage of the difference between 301 and 308 but does not cover this point.

  • How should client of Restful API handle http status 301 redirect upon POST?

  • What's the deal with HTTP status code 308?










share|improve this question















I am specifying a ReST service. I recently stumbled on this IETF draft document which could be interpreted as suggesting that ReST services should always return 308. Note that the document seems to have expired without being superseded (I'm not very clear on the IETF process).



I had it in my mind earlier that a service should return "301 Moved Permanently" for a GET and a "308 Permanent Redirect" for a POST to ensure it is not inappropriately converted to a GET (by something trying to be clever).



Uses of both 301 and 308 seem to be expressed in terms of SHOULDs and SHOULD NOTs rather than MUSTs and MUST NOTs, so it is unclear what "the right thing" is philosphically.



Pragmatically 301 for GET and 308 for POST should work.
308 for GET is not wrong as the current revision at the time of writing includes an example of 308 being produced in response to a GET.
Now there is a deployment concern that if a client doesn't understand 308 it should treat it like a 300 (rather than a 301 which makes more sense to me) but 308 is now widely understood so the question becomes if or why should you ever use HTTP 301?



If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1? Is there a legitimate use case for converting a POST into a GET for a redirect in ReST or in more generally in HTTP?



For 301 HTTP/1.1 says:




Note: For historical reasons, a user agent MAY change the request
method from POST to GET for the subsequent request.




Why was that ever a good idea? Is it still valid anywhere?



See also:





  • What's difference between HTTP 301 and 308 status codes?
    which provides good coverage of the difference between 301 and 308 but does not cover this point.

  • How should client of Restful API handle http status 301 redirect upon POST?

  • What's the deal with HTTP status code 308?







rest http http-status-codes






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 15:38

























asked Nov 22 at 17:51









Bruce Adams

1,5641333




1,5641333












  • tools.ietf.org/html/rfc7538 Generally it's your (design) decision. As in your example there would not be a huge difference. But if you standardize it, you would not need to worry about different cases. Just ask yourself is there a downside using the newer 308 over the old 301? If not use the newer one.
    – Tom-Oliver Heidel
    Nov 22 at 23:25












  • My hope is that with a well defined protocol like HTTP we can move towards designs where there is one right way to do things. In this case I think its 308 (I'm asking 'the internet' why I'm wrong - or possibly right) but if 308 is a bugfix for 301 why didn't the IETF deprecate 301. Does 301 still have a sensible use case separate from 308?
    – Bruce Adams
    Nov 23 at 9:39










  • 308 is not a bug fix. It's rather an extension to secure that the same method will be used (e.g. POST -> POST). How a program or browser reacts to it depends on the implementation. 301 won't deprecate that fast. 308 is there to add another layer of protection/security into the protocol.
    – Tom-Oliver Heidel
    Nov 23 at 14:19










  • How a client should interpret status codes is mostly covered in the standard so its not implementation dependent. If I returned a 400 for a resource that does not exist instead of 404 I would be wrong. There are systems, including "ReSTish" APIs that do not follow the standard properly. There are may be a few ambiguities (301/308 possibly being one). 301 won't disappear from implementations overnight. The question is does 308 make it redundant? (if so the right thing is to always use 308 and label 301 as deprecated).
    – Bruce Adams
    Nov 23 at 14:32










  • Why was that ever a good idea? Is it still valid anywhere? If we are lucky enough, we may get some input from Julian Reschke who authored the RFC 7538 and co-authored the RFC 7231 with Fielding.
    – Cassio Mazzochi Molin
    Nov 23 at 15:13


















  • tools.ietf.org/html/rfc7538 Generally it's your (design) decision. As in your example there would not be a huge difference. But if you standardize it, you would not need to worry about different cases. Just ask yourself is there a downside using the newer 308 over the old 301? If not use the newer one.
    – Tom-Oliver Heidel
    Nov 22 at 23:25












  • My hope is that with a well defined protocol like HTTP we can move towards designs where there is one right way to do things. In this case I think its 308 (I'm asking 'the internet' why I'm wrong - or possibly right) but if 308 is a bugfix for 301 why didn't the IETF deprecate 301. Does 301 still have a sensible use case separate from 308?
    – Bruce Adams
    Nov 23 at 9:39










  • 308 is not a bug fix. It's rather an extension to secure that the same method will be used (e.g. POST -> POST). How a program or browser reacts to it depends on the implementation. 301 won't deprecate that fast. 308 is there to add another layer of protection/security into the protocol.
    – Tom-Oliver Heidel
    Nov 23 at 14:19










  • How a client should interpret status codes is mostly covered in the standard so its not implementation dependent. If I returned a 400 for a resource that does not exist instead of 404 I would be wrong. There are systems, including "ReSTish" APIs that do not follow the standard properly. There are may be a few ambiguities (301/308 possibly being one). 301 won't disappear from implementations overnight. The question is does 308 make it redundant? (if so the right thing is to always use 308 and label 301 as deprecated).
    – Bruce Adams
    Nov 23 at 14:32










  • Why was that ever a good idea? Is it still valid anywhere? If we are lucky enough, we may get some input from Julian Reschke who authored the RFC 7538 and co-authored the RFC 7231 with Fielding.
    – Cassio Mazzochi Molin
    Nov 23 at 15:13
















tools.ietf.org/html/rfc7538 Generally it's your (design) decision. As in your example there would not be a huge difference. But if you standardize it, you would not need to worry about different cases. Just ask yourself is there a downside using the newer 308 over the old 301? If not use the newer one.
– Tom-Oliver Heidel
Nov 22 at 23:25






tools.ietf.org/html/rfc7538 Generally it's your (design) decision. As in your example there would not be a huge difference. But if you standardize it, you would not need to worry about different cases. Just ask yourself is there a downside using the newer 308 over the old 301? If not use the newer one.
– Tom-Oliver Heidel
Nov 22 at 23:25














My hope is that with a well defined protocol like HTTP we can move towards designs where there is one right way to do things. In this case I think its 308 (I'm asking 'the internet' why I'm wrong - or possibly right) but if 308 is a bugfix for 301 why didn't the IETF deprecate 301. Does 301 still have a sensible use case separate from 308?
– Bruce Adams
Nov 23 at 9:39




My hope is that with a well defined protocol like HTTP we can move towards designs where there is one right way to do things. In this case I think its 308 (I'm asking 'the internet' why I'm wrong - or possibly right) but if 308 is a bugfix for 301 why didn't the IETF deprecate 301. Does 301 still have a sensible use case separate from 308?
– Bruce Adams
Nov 23 at 9:39












308 is not a bug fix. It's rather an extension to secure that the same method will be used (e.g. POST -> POST). How a program or browser reacts to it depends on the implementation. 301 won't deprecate that fast. 308 is there to add another layer of protection/security into the protocol.
– Tom-Oliver Heidel
Nov 23 at 14:19




308 is not a bug fix. It's rather an extension to secure that the same method will be used (e.g. POST -> POST). How a program or browser reacts to it depends on the implementation. 301 won't deprecate that fast. 308 is there to add another layer of protection/security into the protocol.
– Tom-Oliver Heidel
Nov 23 at 14:19












How a client should interpret status codes is mostly covered in the standard so its not implementation dependent. If I returned a 400 for a resource that does not exist instead of 404 I would be wrong. There are systems, including "ReSTish" APIs that do not follow the standard properly. There are may be a few ambiguities (301/308 possibly being one). 301 won't disappear from implementations overnight. The question is does 308 make it redundant? (if so the right thing is to always use 308 and label 301 as deprecated).
– Bruce Adams
Nov 23 at 14:32




How a client should interpret status codes is mostly covered in the standard so its not implementation dependent. If I returned a 400 for a resource that does not exist instead of 404 I would be wrong. There are systems, including "ReSTish" APIs that do not follow the standard properly. There are may be a few ambiguities (301/308 possibly being one). 301 won't disappear from implementations overnight. The question is does 308 make it redundant? (if so the right thing is to always use 308 and label 301 as deprecated).
– Bruce Adams
Nov 23 at 14:32












Why was that ever a good idea? Is it still valid anywhere? If we are lucky enough, we may get some input from Julian Reschke who authored the RFC 7538 and co-authored the RFC 7231 with Fielding.
– Cassio Mazzochi Molin
Nov 23 at 15:13




Why was that ever a good idea? Is it still valid anywhere? If we are lucky enough, we may get some input from Julian Reschke who authored the RFC 7538 and co-authored the RFC 7231 with Fielding.
– Cassio Mazzochi Molin
Nov 23 at 15:13












1 Answer
1






active

oldest

votes


















0















If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1?




No, it's not.



The RFC 7538, which defines the 308 status code, doesn't invalidate or make 301 obsolete. It just defines another status code to fill a gap on the RFC 7231, which does not define a permanent
variant of status code 307:



+-------------------------------------------+-----------+-----------+
| | Permanent | Temporary |
+-------------------------------------------+-----------+-----------+
| Allows changing the request method from | 301 | 302 |
| POST to GET | | |
| Does not allow changing the request | - | 307 |
| method from POST to GET | | |
+-------------------------------------------+-----------+-----------+


In practical terms, I still see 301 being largely used in SEO. And I've seen some HTTP clients that don't recognize 308.





Apart from the RFCs, let's have a look what MDN Web Docs from Mozilla say about 301:




The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



Even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there. It is therefore recommended to use the 301 code only as a response for GET or HEAD methods and to use the 308 Permanent Redirect for POST methods instead, as the method change is explicitly prohibited with this status.




Now see what Mozilla says about 308:




The HyperText Transfer Protocol (HTTP) 308 Permanent Redirect redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



The request method and the body will not be altered, whereas 301 may incorrectly sometimes be changed to a GET method.




Note: Some Web applications may use the 308 Permanent Redirect in a non-standard way and for other purposes. For example, Google Drive uses a 308 Resume Incomplete response to indicate to the client when an incomplete upload stalled. (reference)








share|improve this answer























  • I can't accept this answer without an explanation for why it is a good idea to "allows changing the request method from POST to GET" as that is the crux of the difference.
    – Bruce Adams
    Nov 30 at 17:53











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53436107%2fis-there-still-a-use-case-for-http-301-rather-than-http-308-to-indicate-that-a-r%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0















If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1?




No, it's not.



The RFC 7538, which defines the 308 status code, doesn't invalidate or make 301 obsolete. It just defines another status code to fill a gap on the RFC 7231, which does not define a permanent
variant of status code 307:



+-------------------------------------------+-----------+-----------+
| | Permanent | Temporary |
+-------------------------------------------+-----------+-----------+
| Allows changing the request method from | 301 | 302 |
| POST to GET | | |
| Does not allow changing the request | - | 307 |
| method from POST to GET | | |
+-------------------------------------------+-----------+-----------+


In practical terms, I still see 301 being largely used in SEO. And I've seen some HTTP clients that don't recognize 308.





Apart from the RFCs, let's have a look what MDN Web Docs from Mozilla say about 301:




The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



Even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there. It is therefore recommended to use the 301 code only as a response for GET or HEAD methods and to use the 308 Permanent Redirect for POST methods instead, as the method change is explicitly prohibited with this status.




Now see what Mozilla says about 308:




The HyperText Transfer Protocol (HTTP) 308 Permanent Redirect redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



The request method and the body will not be altered, whereas 301 may incorrectly sometimes be changed to a GET method.




Note: Some Web applications may use the 308 Permanent Redirect in a non-standard way and for other purposes. For example, Google Drive uses a 308 Resume Incomplete response to indicate to the client when an incomplete upload stalled. (reference)








share|improve this answer























  • I can't accept this answer without an explanation for why it is a good idea to "allows changing the request method from POST to GET" as that is the crux of the difference.
    – Bruce Adams
    Nov 30 at 17:53
















0















If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1?




No, it's not.



The RFC 7538, which defines the 308 status code, doesn't invalidate or make 301 obsolete. It just defines another status code to fill a gap on the RFC 7231, which does not define a permanent
variant of status code 307:



+-------------------------------------------+-----------+-----------+
| | Permanent | Temporary |
+-------------------------------------------+-----------+-----------+
| Allows changing the request method from | 301 | 302 |
| POST to GET | | |
| Does not allow changing the request | - | 307 |
| method from POST to GET | | |
+-------------------------------------------+-----------+-----------+


In practical terms, I still see 301 being largely used in SEO. And I've seen some HTTP clients that don't recognize 308.





Apart from the RFCs, let's have a look what MDN Web Docs from Mozilla say about 301:




The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



Even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there. It is therefore recommended to use the 301 code only as a response for GET or HEAD methods and to use the 308 Permanent Redirect for POST methods instead, as the method change is explicitly prohibited with this status.




Now see what Mozilla says about 308:




The HyperText Transfer Protocol (HTTP) 308 Permanent Redirect redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



The request method and the body will not be altered, whereas 301 may incorrectly sometimes be changed to a GET method.




Note: Some Web applications may use the 308 Permanent Redirect in a non-standard way and for other purposes. For example, Google Drive uses a 308 Resume Incomplete response to indicate to the client when an incomplete upload stalled. (reference)








share|improve this answer























  • I can't accept this answer without an explanation for why it is a good idea to "allows changing the request method from POST to GET" as that is the crux of the difference.
    – Bruce Adams
    Nov 30 at 17:53














0












0








0







If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1?




No, it's not.



The RFC 7538, which defines the 308 status code, doesn't invalidate or make 301 obsolete. It just defines another status code to fill a gap on the RFC 7231, which does not define a permanent
variant of status code 307:



+-------------------------------------------+-----------+-----------+
| | Permanent | Temporary |
+-------------------------------------------+-----------+-----------+
| Allows changing the request method from | 301 | 302 |
| POST to GET | | |
| Does not allow changing the request | - | 307 |
| method from POST to GET | | |
+-------------------------------------------+-----------+-----------+


In practical terms, I still see 301 being largely used in SEO. And I've seen some HTTP clients that don't recognize 308.





Apart from the RFCs, let's have a look what MDN Web Docs from Mozilla say about 301:




The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



Even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there. It is therefore recommended to use the 301 code only as a response for GET or HEAD methods and to use the 308 Permanent Redirect for POST methods instead, as the method change is explicitly prohibited with this status.




Now see what Mozilla says about 308:




The HyperText Transfer Protocol (HTTP) 308 Permanent Redirect redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



The request method and the body will not be altered, whereas 301 may incorrectly sometimes be changed to a GET method.




Note: Some Web applications may use the 308 Permanent Redirect in a non-standard way and for other purposes. For example, Google Drive uses a 308 Resume Incomplete response to indicate to the client when an incomplete upload stalled. (reference)








share|improve this answer















If 308 is essentially a bug fix for 301, why isn't 301 officially deprecated in HTTP/1.1?




No, it's not.



The RFC 7538, which defines the 308 status code, doesn't invalidate or make 301 obsolete. It just defines another status code to fill a gap on the RFC 7231, which does not define a permanent
variant of status code 307:



+-------------------------------------------+-----------+-----------+
| | Permanent | Temporary |
+-------------------------------------------+-----------+-----------+
| Allows changing the request method from | 301 | 302 |
| POST to GET | | |
| Does not allow changing the request | - | 307 |
| method from POST to GET | | |
+-------------------------------------------+-----------+-----------+


In practical terms, I still see 301 being largely used in SEO. And I've seen some HTTP clients that don't recognize 308.





Apart from the RFCs, let's have a look what MDN Web Docs from Mozilla say about 301:




The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



Even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there. It is therefore recommended to use the 301 code only as a response for GET or HEAD methods and to use the 308 Permanent Redirect for POST methods instead, as the method change is explicitly prohibited with this status.




Now see what Mozilla says about 308:




The HyperText Transfer Protocol (HTTP) 308 Permanent Redirect redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL).



The request method and the body will not be altered, whereas 301 may incorrectly sometimes be changed to a GET method.




Note: Some Web applications may use the 308 Permanent Redirect in a non-standard way and for other purposes. For example, Google Drive uses a 308 Resume Incomplete response to indicate to the client when an incomplete upload stalled. (reference)









share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 at 15:15

























answered Nov 23 at 14:54









Cassio Mazzochi Molin

55.6k1699169




55.6k1699169












  • I can't accept this answer without an explanation for why it is a good idea to "allows changing the request method from POST to GET" as that is the crux of the difference.
    – Bruce Adams
    Nov 30 at 17:53


















  • I can't accept this answer without an explanation for why it is a good idea to "allows changing the request method from POST to GET" as that is the crux of the difference.
    – Bruce Adams
    Nov 30 at 17:53
















I can't accept this answer without an explanation for why it is a good idea to "allows changing the request method from POST to GET" as that is the crux of the difference.
– Bruce Adams
Nov 30 at 17:53




I can't accept this answer without an explanation for why it is a good idea to "allows changing the request method from POST to GET" as that is the crux of the difference.
– Bruce Adams
Nov 30 at 17:53


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53436107%2fis-there-still-a-use-case-for-http-301-rather-than-http-308-to-indicate-that-a-r%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

Alexandru Averescu

Trompette piccolo