This is because, by default, the Location header is not displayed to the calling client (in this case, your Ajax code) (this is "unsafe"). To open it, you must return an additional header:
Access-Control-Expose-Headers: Location
In this case, the browser will open it so that the client can read it. You can add multiplied comma headers there. Read more about it here . Here you can read which methods, headers and content types are safe (simple) and do not require any additional configuration.
source share