I have forwarded godaddy subdomains backend.example.com and app.example.com to the same public IP XXX.XXX.XXX.XXX of Google Compute Engine. I have nginx webserver configured and my springboot backend is serving on port 8090. Currently using the following configuration-
server {
listen 80;
gzip on;
server_name backend.example.com;
location / {
root html/example;
index index.html;
}
location /private {
proxy_pass https://127.0.0.1:8090;
}
location ~* \.(gif|jpg|jpeg|png|js|css)$ { }
}
My web application is working fine. But RESTful api calls only working when the url is http://XXX.XXX.XXX.XXX/api/view. When http://backend.example.com/api/view is used as url , getting back following html response
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Backend</title>
<META name="description" content="Backend">
</head>
<frameset rows="100%,*" border="0">
<frame src="http://XXX.XXX.XXX.XXX" frameborder="0" />
<frame frameborder="0" noresize />
</frameset>
<!-- pageok -->
<!-- 12 -->
<!-- -->
</html>
I want JSON response to be served in backend.example.com/api/view like the way its happening for XXX.XXX.XXX.XXX/api/view. I have tried many different configuration setting in nginx config file but nothing worked. Need some suggestions how to fix this.