Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Angular | Receiving index.html when using proxy

$
0
0

Im learning Angular, and when i try to use proxy, still getting index.html

I am using proxy as below

{"/api/*": {"target": "http://localhost:8080/v1/api/playground","secure": false,"pathRewrite": {"^/api": ""    },"changeOrigin": true,"logLevel": "debug"  }}

And My request is as below where sending request where playgroundId is uuid but I am still getting index.html as response

private apiUrl = '/api/playground/';const response = await fetch(this.apiUrl + this.playgroundId);

When I am trying to send another request as below, I am getting json in response.

private apiUrl = '/api/playgrounds';const response = await fetch(this.apiUrl);

` it returning json in response.

I checked logs in server, and in case of 1 request, server do not receives it, but in case of 2, server do receive request.

Any help in this is appreciated

!! I DONT WANT TO CHANGE CORS POLICY ON SERVER SIDE NOW !!


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>