I have an Angular app that makes an httpClient.get() call to an Api.I developed that api with SpringBoot and it should return a json.I set @CrossOrigins(*) on each method and when I try to call the version of the Api deployed on the Weblogic server I use for testing, it works.Anyway, now the same Api is deployed on another Weblogic Server that requires Basic Authentication.If I try to call the Api deployed on the new Server, setting it up with the basic auth header, it gives me this two errors, like it makes two different calls
When I don't put any auth headers, it obviously returns only a 401 Authentication Failed.So I don't think it depends from the authentication header.
Anyway, to be sure of it, I tried to make the same call from another SpringBoot app, setting it up with the same authentication header, and the it returns the json correctly.
I really don't have any clues.Anyway this is how I set up the calls through auth interceptor:
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {if(environment.authentication){req = req.clone({ setHeaders: {'Content-Type' : 'application/json; charset=utf-8','Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7','Authorization': `Basic ${btoa(environment.user+':'+ environment.password)}`, },}); } else req = req;return next.handle(req);}
I checked the first request (the one with 500) and the btoa header is identical to the one sent from java or from the browser.Please suggest me what can it be...