I have a nginx reverse proxy deployed. I have few services
- Service A : https service with its own certificate running on port 8080.
- Service B: https service with its own certificate running on port 8080.
We have only 1 entry point to the application via nginx and through IP address and not dns names. We want to do the path based routing. If /servicea is requested we need to forward the request to Service A and certificates need to be of service A. Similarly for Service B.
Explored the SNI based solution but it works based on host name. How can we achieve above configuration in nginx ?
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
listen 443 ssl;
root /usr/share/nginx/html;
index index.html;
server_name localhost;
ssl_certificate /etc/nginx/ssl/tls.crt;
ssl_certificate_key /etc/nginx/ssl/tls.key;
location / {
try_files $uri $uri/ =404;
}
location /servicea/ {
proxy_pass https://servicea:8080/;
}
}