I am using Traefik 2.0 as a reverse-proxy in my application docker-compose file. The docker-compose file i am using is:
version: '3.2'
services:
myapp.com:
image: myappservice:master
restart: always
labels:
- traefik.enable=true
- traefik.http.routers.myapp.rule=PathPrefix(`/api/`)
myui:
image: myui:latest
restart: always
ports:
- 90:80
labels:
- traefik.enable=true
- traefik.http.routers.myui.rule=Path(`/`)
proxy:
image: traefik:v2.0 # The official v2.0 Traefik docker image
command:
- --api.insecure=true # Enable the web UI
- --log.level=DEBUG
- --entrypoints.insecure.address=:80
- --entrypoints.secure.address=:443
- --providers.docker=true
- --providers.docker.network=traefik-network
- --providers.docker.exposedByDefault=false
- --providers.file.directory=/etc/traefik/configuration/
- --providers.file.watch=true
ports:
- 80:80 # The HTTP port
- 443:443 # The HTTPS port
- 8080:8080 # The traefik Web UI
volumes:
- '/var/run/docker.sock:/var/run/docker.sock' # So that Traefik can listen to the Docker events
- './traefik:/etc/traefik/configuration'
networks:
default:
external:
name: "traefik-network" #The same network defined in Docker provider config
After deploying this file with docker-compose up command, the UI (provided by the myui container) should be available in the browser when accessing the url: http://localhost:80/
Case 1: As per the traefik configuration via labels, this url http://localhost:80/ should forward the request to myui container's port 80 and it should display the UI. But this is not happening properly. The correct title/name is displayed in the browser tab's title bar as "MyUi". But the content is not displayed.
Case 2: There is no problem with the myui container as the URL http://localhost:90/ (which directly access the myui container via the mapped hostport) displays the UI properly.
When i used 'View page source' on the resulting page in the google chrome browser, in both cases, the source seems the same.
I used different browsers to check this, every time the result was same.
I used API clients like Insomnia to check the result of the GET request http://localhost:80/ and http://localhost:90/ , both returned 200 OK response.
Is this a problem with Traefik? Or is it something else?
Can someone help me to solve this?