How does the HTTP POST Location header work for redirecting responses? or When should you use the HTT

20 Replies, 1799 Views

Yeah, the http post location header doesn’t force a redirect. It’s more like a suggestion.

If you want auto-redirects, the server should send a 3xx status code (like 301 or 302). The location header alone won’t do it unless the client is configured to follow.

For APIs, it’s common to use it with 201 to point to the new resource. But some frameworks (looking at you, Django REST) add it by default even when it’s not needed.

Messages In This Thread



Users browsing this thread: 1 Guest(s)