Hello,
I'm stucked with a simple config(I mean) about proxy pass with Traefik. In case, I want to proxy all requests in my host to my application.
What I want to do it's similiar with this in Nginx:
server{
server_name example;
location / {
proxy_pass http://127.0.0.1:8001;
}
}
In this case I'm using this simple config and getting 404 from traefik.
docker-compose.yaml
services:
traefik:
image: traefik:v2.10.1
command:
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.address=:80"
- "--api.insecure=true"
- "--log.level=DEBUG"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
myapp:
build:
context: ./myapp/
dockerfile: Dockerfile
depends_on:
- traefik
ports:
- "8001:8001"
command: bash -c "
uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8001"
labels:
- "traefik.enable=true"
- "traefik.http.routers.myapp.rule=Host(`myapp.localhost`)"
In the example above, I'm running an application and exposing the port 8001, so, I would to access my server(an IP or domain) and expected that traefik pass the request to my internal container(myapp), running in http://127.0.0.1:8001 inside my server.
What I need to do?