Access to XMLHttpRequest at ‘http://localhost:9000/api/authentication/validate’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
This is not possible in SonarQube itself. The way you would set custom HTTP headers would be via a reverse proxy (note: we recommend using a reverse proxy to use HTTPS, so this could be part of that setup).
I see you’re running something on http://localhost:4200, so I’m guessing this is some sort of local development setup? Perhaps you could start some local NginX server, which would proxy to both ports (perhaps using subfolders?).
Hi @Wouter_Admiraal, I’m coding a call to the API from a Gitlab Page coded in vanilla JS and I’m wondering if I will face the same problem. Should I use an HTTP client as a proxy instead to construct my API call with a UserToken in a header?
In my use case I want to display all badges for all projects in a static website that’s hosted on a Gitlab pages site.