What is correct HTTP status code when redirecting to a login page?

I’d say 303 see other 302 Found:

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

fits a login page most closely in my opinion. I initially considered 303 see other which would work just as well. After some thought, I’d say 302 Found is more fitting because the requested resource was found, there just is another page to go through before it can be accessed. The response doesn’t get cached by default which is fine as well.

Leave a Comment