Answer the question
In order to leave comments, you need to log in
Why is the request not going through?
There is such an error
Failed to load https:: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:4200, *', but only one is allowed. Origin 'http://localhost:4200' is therefore not allowed access.
core.js:1673 ERROR HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: null, ok: false, …}
defaultErrorLogger @ core.js:1673
zone.js:2969 Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type text/plain. See https://www.chromestatus.com/feature/5629709824032768 for more details.
Answer the question
In order to leave comments, you need to log in
You are told that the request contains too many Access-Control-Allow-Origin values.
And it is also written that it is desirable to contact http://localhost, and not localhost:4200
I would very much doubt the account "by default skips all requests", usually, the security requirements of all web applications indicate that all cross domain requests will be blocked until the programmer on the back manually puts permission to receive cross domain request from a specific host.
Plus, for each session id, a response from the server will be generated, in which only 1 domain is specified. In your case, there are more than one of them, which is not true.
And as far as I remember, you cannot set a wildcard on the Access-Control-Allow-Origin header, and you have * .
Tell your developer if they want to allow all requests from any domain, then you can do something like this:
HttpServletResponse.addHeader("Access-Control-Allow-Origin", HttpServletRequest.getHeader("Origin")); - this will be a replacement for wildcard type *
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question