When i am hitting sonarQube api in Postman it is working fine but not in react

When i am using the api in the postman it is working fine, but when i am trying to call it using axio it is returning a webPage print loading.Preformatted text

axios code and output: useEffect(() => {
        axios.get('/api/projects/search', {
            headers: {
                Authorization: 'Bearer squ_eae327a8a41ecdb560c91eb0da28d0d167c60e53'
            }
        }).then((response) => {
            console.log(response.data);
        });

    }, [])

my proxy server code is:

const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');

const app = express();

app.use(express.static('build', { fallthrough: true }));  // Serve static files except for '/api'

// Proxy requests to SonarQube
app.use('/api', createProxyMiddleware({
target: 'http://localhost:9000',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}));

// Start the server
const port = process.env.PORT || 3001;
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});

The text you’re receiving tends to me what SonarQube shows when an invalid page is queried, but the request still hits the SonarQube server.

I suggest you check your SonarQube instance’s logs/access.log to see what URL is actually getting hit by your middleware compared to Postman. Then you should be able to adjust your code.