Comment by cryptonector

3 days ago

REST is all about MIME types and Accept/Content-Type. So there goes REST.

TFA makes me think that your argument is stronger than I would have thought yesterday, though I still prefer to have Accept/Content-Type negotiation. Sibling's comment about negotiation is on-point.

    GET /article HTTP/1.1
    Accept: text/markdown,text/x-markdown;q=0.9,text/plain;q=0.8,text/html;q=0.3
    Accept-Language: es-AR,es-419,es;q=0.9,en;q=0.8,ja;q=0.7

    HTTP/1.1 307 Found
    Location: /en-US/article.html
    Vary: Accept, Accept-Language
    Cache-Control: public, max-age=31536000
    ETag: whatever

    GET /en-US/article.html HTTP/1.1
    Accept: text/markdown,text/x-markdown;q=0.9,text/plain;q=0.8,text/html;q=0.3
    Accept-Language: es-AR,es-419,es;q=0.9,en;q=0.8,ja;q=0.7

    HTTP/1.1 200 OK
    Content-Type: text/html; charset=utf-8
    Content-Language: en-US
    Content-Length: tl;dr
    Cache-Control: public, max-age=31536000
    ETag: whatever-deux

And I think there is Content-Location header as well?.. My point is, it's possible to divorce caching of the server's response that choses the best available representation from caching of the actual content, and if you can't send Vary with the first response, then "Cache-Control: private, max-age=0" will still probably won't kill your redirection-making server. Or there is the Negotiate/Alternates + 300 response code mechanism as well!

  • Content-Location can't be used as the cache key though. But yes, you can use 3xx redirects and Location.