HTTP question


OK, RESTafarians and HTTP experts, here’s a question. Is it kosher to send a Location: header back with an ordinary, say 200, response?

Scenario: the server knows better than the client what the client needs. ‘I realize you asked for, but instead I’m sending you — ready or not, here it comes..’

Related Posts

3 Replies to “HTTP question”

  1. I’m no expert, but doesn’t it depend on what the client asks for? e.g. charset, encoding, language, Accept field etc.

    I suppose that all other things being equal, the server could return a 300 – Multiple Choices. In this case, the server can use the Location: field to specify which one of the multiple choices it thinks the client should see.

    In fact, the exact wording for 300 in RFC 2616 is: “If the server has a preferred choice of representation, it SHOULD include the specific URI for that representation in the Location field; user agents MAY use the Location field value for automatic redirection.”

  2. It sounds like you want a redirect, perhaps 302/307 or 303.

    The meaning of a Location header in a 200 response is undefined.

    If you don’t want to redirect, you can use Content-Location on the response.

Comments are closed.

© All Right Reserved
Proudly powered by WordPress | Theme: Shree Clean by Canyon Themes.