HTTP Response Codes indicate whether a specific HTTP requests has been successfully completed. Responses are grouped in five classes: informational responses, successful responses, redirections, client errors, and servers errors.
Questions tagged [http-response-codes]
346 questions
18
votes
1 answer
What's a proper response status code to REST POST request when duplicate is found?
In my RESTful API client might try to post information that is already in the database, this is not an error, rather something client can ignore, maybe notify the user about already existing dublicate.
Now i'm returning 409 Conflict and already…

miceuz
- 3,327
- 5
- 29
- 33
16
votes
1 answer
Returning HTTP 401 status for AJAX responses without WWW-Authenticate
Is it OK to return an HTTP 401 status for a response to an AJAX call if you wish to convey that the user is not logged in, even though the login mechanism is form-based and not HTTP based (Basic, Digest, etc.)?
The answer here suggests that 401…

user193130
- 8,009
- 4
- 36
- 64
14
votes
1 answer
When should I return HTTP Status Code 500 (Internal Server Error) from REST application to client?
I have seen people using the HTTP code 500 as a generic error code for all kind of error cases (server errors, http errors, code exceptions, expected record not found in DB, time-out exceptions etc). However I have also read and heard that this code…

Pratap
- 655
- 2
- 10
- 20
11
votes
3 answers
REST HTTP response code for missing parent resource
My question is, should I return a HTTP response code of 400 Bad Request, 404 Not Found or 410 Gone when a parent resource, or higher, does not exist / has been deleted?
Looking for some guidance around how to handle a missing links in a RESTful…

It's an account
- 143
- 1
- 8
11
votes
0 answers
Send SC_UNAUTHORIZED for an authenticated request
I want to put some additional checks (in a filter) to some parameters after the request is authenticated by Spring and based on those checks want to allow or block the login. If the checks fails then I want to send a 401 in response instead of 200…

Saqeeb Shaikh
- 159
- 5
11
votes
4 answers
How to change http response code on an object in Amazon S3
I have a webpage hosted on Amazon S3 but I don't want the http response code to be 200. The page is a maintenance page that I'll redirect traffic to when I take our main website down for maintenance.
I want the Amazon S3 page to include a response…

Tom
- 14,041
- 16
- 64
- 80
11
votes
3 answers
Why does django return 301 and 302 as server response codes after a user logs in and a flatpage is displayed?
I'm creating a django app. Users login and are shown a static web page that is managed by the flatpages app.
Here are typical status messages from the dev server:
[15/Aug/2013 18:43:16] "GET / HTTP/1.1" 200 1263
[15/Aug/2013 18:43:23] "POST /…

benevolentprof
- 1,507
- 2
- 13
- 24
11
votes
1 answer
How to serve audio file for streaming from Grails with code 206?
I'm trying to stream out an audio/wav using HTML5 feature in the following way:
This is working quite well on Chrome, except for the fact it's…

amit
- 1,991
- 1
- 18
- 29
10
votes
5 answers
Is there a content Header Type for adding HttpResponseHeader?
The only method I see in HttpResponseHeaders is Add which takes string type for header type.
I just wonder did .NET provided a list of HttpResponseHeader type contants in string?
So I can do:
HttpResponseMessage response =…

King Chan
- 4,212
- 10
- 46
- 78
9
votes
2 answers
How to find the location URL in a Django response object?
Let's say I have a Django response object.
I want to find the URL (location).
However, the response header does not actually contain a Location or Content-Location field.
How do I determine, from this response object, the URL it is showing?

Joseph Turian
- 15,430
- 14
- 47
- 62
9
votes
3 answers
What response code is appropriate for this situation?
I'm developing a webgame. As part of the game, you start out with a limited set of features, and you unlock more of them as you play.
For instance, you unlock /fields as part of step 3 in the tutorial. But what if you just navigate to /fields in the…

Niet the Dark Absol
- 320,036
- 81
- 464
- 592
9
votes
4 answers
What HTTP response code should be used for an OPTION request?
I noticed that the Mozilla HTTP response codes documentation states that
The methods PUT, DELETE, and OPTIONS can never result in a 200 OK
response.
However it doesn't make clear what response should actually be used. My best guess would be 204:…

Joshua
- 6,320
- 6
- 45
- 62
8
votes
3 answers
Return HTTP error from RESTeasy interface
Is it possible to return a HTTP error from a RESTeasy interface? I am currently using chained web-filters for this but I want to know if it is possible straight from the interface...
Example sudo-code:
@Path("/foo")
public class FooBar {
@GET
…

travega
- 8,284
- 16
- 63
- 91
8
votes
4 answers
Making Struts send 500 Internal Server Error when exceptions get thrown
I'm working on an AJAX-enabled JavaScript frontend that makes calls to a Java backend written with Struts. My problem is that when the backend throws an exception, the client still sees a "200 OK" HTTP response code instead of "500 Internal Server…

curtisdf
- 4,130
- 4
- 33
- 42