Angular always returns the index.html file content as a response (instead of JSON data) when calling NestJS (NodeJS) APIs with an Nginx reverse proxy when I access to my webapp from a public IP x.x.x.x but when I access it from localhost (same machine where Nginx is installed), everything works well.
Here is my nginx.conf content:
server {
listen 80;
listen [::]:80;
server_name _;
root C:/Project/front;
location / {
index index.html;
try_files $uri $uri/ /index.html;
}
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://localhost:3001/;
}
}
Appreciate your help. Thanks !