It's important to respect REST request. In some cases, you want to redirect all users who're using their browsers but what if you are using REST to create user accounts, browsing some content...etc
Currently REST APIs are interrupted with 302 redirect response. This patch simply check if any Content-Type exist in the header and it will ignore the redirect if the Content-Type exist.
TODO:
We can add option in settings form to respect REST requests.
QUESTIONS:
Should we check _format parameter as REST request indicator instead of the Content-Type?
Comments
Comment #2
meladawy commentedComment #3
hexblot commentedI am having some trouble with this request:
If we can find a way to reliably differentiate between interactive web requests and API requests (REST/JSON:API/other), I'm all for implementing this.
Comment #4
bradhawkins commentedHere's a patch that allows for "Whitelisted Referer Overrides" which allows the admin to enter a list of referring domains that should be excluded from redirection.
Obviously, this won't work in every situation, but for sites where the backend uses a different domain from the front-end, this can provide a solution.
Comment #5
meladawy commentedComment #6
meladawy commentedThis patch is following the same old approach as in #2 but compatible with the latest release.