I can't resolve my problem with redirecting traffic to my services in one host. Here's my current Docker compose file:
version: '2'
services:
nginx-proxy:
image: nginxproxy/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
backend:
build:
context: /root/api
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
- VIRTUAL_HOST=app.domain.com
- VIRTUAL_PATH=/api/
- VIRTUAL_DEST=/api/
front:
build:
context: /root/app
dockerfile: Dockerfile
environment:
- VIRTUAL_HOST=app.domain.com
- VIRTUAL_DEST=/
- VIRTUAL_PATH=/
my backend service serve all endpoints on /api/* and I want to redirect all from app.domain.com/* to frontend service, and all from app.domain.com/api/* to backend service. But with this configuration, only app.domain.com/ is redirected to frontend, for example app.domain.com/login gives 404 error. How to fix it?