0

I have a network of 3 containers set up in a docker-compose.yml. 2 containers are web applications and the third is a reverse proxy. All 3 containers run nginx. This is the nginx.conf for the reverse proxy:

events {}
http {
    server {
        listen       8090;
        server_name  localhost;
        location / {
            proxy_pass http://myappui:8080;
        }
        location /admin/ {
            proxy_pass http://myappadmin:8081/;
#  this works  proxy_pass http://microsoft.com/;
        }
        }
    }

The problem is that the proxy_pass for the location /admin/ somehow routes calls to the first container as http://myappui:8080/admin rather than passing to the second container as http://myappadmin:8081/. If, for location /admin/, I replace myappadmin:8081 with microsoft.com, it works and the calls are correctly routed to microsoft.com.

If I call the second container myappadmin with the automatically assigned host port, it opens the myappadmin application correcly.

This is my docker-compose:

version: '3.4'

services:
  myappui:
    build:
      dockerfile: ./Docker/Dockerfile.ui
    tty: true
    container_name: myappui
    ports:
    - "8080"
    networks:
    - webnet

  myappadmin:
    build:
      dockerfile: ./Docker/Dockerfile.admin
    tty: true
    container_name: myappadmin
    ports:
    - "8081"
    networks:
    - webnet    

  nginx: 
    image: nginx:latest
    tty: true
    container_name: myappreverseproxy
    ports:
    - "8090:8090"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
    networks:
    - webnet

networks:
  webnet  :
    driver: bridge

1 Answer 1

0

The problem turned out to be related to running the admin app in a subfolder. It is an issue of setting correct application path in a Blazor Webassembly app. The reverse proxy has no issues.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.