I have Spring boot and Angular app in Tomcat Container deployed on Server. It works totally fine on localhost.
Now I am trying to map my domain with the application.
When I call my domain then API calls from Angular to Spring are not getting executed.
Since they are on same server I use localhost to call the API from angular to spring.
Which works on my server browser itself but not somewhere else which is clear to me why it's not working.
But I am not totally sure how to go around it.
Here is my nginx configuration:
server {
listen 80;
server_name localhost mydomain mydomain;
#access_log logs/host.access.log main;
location {
root html;
proxy_pass http://mydomain:8080;
index index.html index.htm;
}
}
Tomcat configuration:
<Host name="mydomain" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Alias>mydomain</Alias>
<Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />
</Host>
My questions are:
Should I use the Server IP while calling the API from Angular to Spring? Will it work?
Second question is when I call my domain it redirects to tomcat manager page. I want it to go to
localhost:8080/myApp
.
I tried proxy_pass
as http://mydomain:8080/myapp
& http://localhost:8080/myapp
but still no success.
Any pointers for both of these questions would be highly appreciated.
I am available here for any information.