Reverse proxy spring-boot microservices using subdomains in nginx on azure windows virtual machine

pavanknrhnk 1 Reputation point
2022-08-02T12:25:25.843+00:00

I have 3 microservices, 1 frontend website and 2 data proccessing microservices both running on different ports.

I have a virtual machine on azure and bought a domain and already set the A name to my IP address and it is redirecting well.

I have also installed the nginx windows version and the requests to port 80 serve the front end website.

I am trying to reverse proxy requests based on the incoming sub domain to a specific springboot microservice but I always get them serving the frontend site using Azure(https://hkrtrainings.com/microsoft-azure-fundamentals-training-for-az-900) . what might be my problem?

here is my nginx.conf (servers only)

    listen       80;  
    server_name  myserverdomain.com;  

    location / {  
    proxy_pass https://myotherserver.com/;  
    proxy_set_header Host $proxy_host;  
    proxy_set_header X-Real-IP $remote_addr;  
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
    }  

}  
server {  
    listen       80;  
    server_name  test1.myserverdomain.com;;  

    location / {  
    proxy_pass http://127.0.0.1:8080;  
    }  

     
}
Community Center | Not monitored
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.