I have created two Rest API's in the backend (same webservice), one for the effective URL and other for the Redirected URL. I'm doing a 308 redirection here when user hits effective URL.
Scenario's
When I mark the API's as POST or PATCH or DELETE,
In Google chrome, my request always goes to the older url (effective) first and then get's redirected to the other one.
I had breakpoints in both of the API's and validated that the request always hit's effective first for the above 3 HTTP methods. Also, I have hit the API like 20+ times via Ajax from the browser.
When I mark the API's as GET,
Only the first time, my request goes to the effective url and redirected to the other one. Subsequent call's via the same browser DIRECTLY takes me the other one until I clear the browser cache.
I suppose this is expected behaviour of permanent redirection (301/308). Also, I'm aware of the difference between 301 and 308.
The major confusion is why the behaviour is not working as intended for NON-GET API's which are POST, PATCH, DELETE etc.
Chrome browser version: Version 88.0.4324.192 (Official Build) (x86_64)
-
Browsers simply don't implement this.Evert– Evert2021年03月14日 06:31:55 +00:00Commented Mar 14, 2021 at 6:31
-
@Evert can you please be more specific?Manikandan kk– Manikandan kk2021年03月14日 06:33:46 +00:00Commented Mar 14, 2021 at 6:33
-
I'm not sure how else to say it. Browsers don't implement 100% of the HTTP standard. It's going to be hard to track down 'why'.Evert– Evert2021年03月14日 07:15:07 +00:00Commented Mar 14, 2021 at 7:15