# 404 when using PathPrefix or Path

**URL:** https://community.traefik.io/t/404-when-using-pathprefix-or-path/13609
**Category:** Traefik v2
**Tags:** docker
**Created:** [February 27, 2022, 5:47pm UTC](https://community.traefik.io/t/404-when-using-pathprefix-or-path/13609 "2022-02-27T17:47:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![riyad](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@riyad](https://community.traefik.io/u/riyad)
#### Post date: [February 27, 2022, 5:47pm UTC](https://community.traefik.io/t/404-when-using-pathprefix-or-path/13609/1 "2022-02-27T17:47:34Z")

</div>

I have been trying to configure traefik as a reverse proxy for [Streamlit](https://streamlit.io/). `"traefik.http.routers.streamlit.rule=Host(`streamlit.localhost`)"` works, but `streamlit.localhost` URL returns properly. But `"traefik.http.routers.streamlit.rule=Path(`/streamlit`)"` doesn't work. `localhost/streamlit` just returns `404`.

This is my docker-compose file.

```auto
version: "3.3"

services:

  traefik:
    image: "traefik:v2.6"
    container_name: "traefik"
    restart: unless-stopped
    command:
      #- "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    networks:
      - traefik
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  whoami:
    image: "traefik/whoami"
    container_name: "simple-service"
    networks:
      - traefik
    labels:
      - "traefik.enable=true"
      # This works
      # - "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
      # This works
      - "traefik.http.routers.whoami.rule=PathPrefix(`/whoami`)"
      - "traefik.http.routers.whoami.entrypoints=web"

  streamlit:
    image: "streamlit:develop"
    container_name: "streamlit"
    command: pipenv run streamlit run streamlit-app.py
    restart: unless-stopped
    ports:
      - 8501
    networks:
      - traefik
    labels:
      - "traefik.enable=true"
      # This doesn't work
      # - "traefik.http.routers.streamlit.rule=PathPrefix(`/streamlit`)"
      # This doesn't work
      # - "traefik.http.routers.streamlit.rule=Path(`/streamlit`)"
      # This works
      # - "traefik.http.routers.streamlit.rule=Host(`streamlit.localhost`)"
      # `streamlit.localhost` works but `localhost/streamlit` doesn't work
      - "traefik.http.routers.streamlit.rule=Host(`streamlit.localhost`) || PathPrefix(`/streamlit`)"
      - "traefik.http.routers.streamlit.entrypoints=web"
      - "traefik.http.services.streamlit.loadbalancer.server.port=8501"

networks:
  traefik: 
    driver: bridge

```

Streamlit supports [Streamlit Configuration](https://docs.streamlit.io/library/advanced-features/configuration). I've also tried setting the configuration, but couldn't get `localhost/streamlit` URL working.

```auto
[server]

# The base path for the URL where Streamlit should be served from.
# Default: ""
baseUrlPath = "/streamlit"

```

---

<div class="post-metadata">

### Author: ![xr71](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/xr71/32/5245_2.png) [@xr71](https://community.traefik.io/u/xr71)
#### Post date: [April 22, 2022, 3:21am UTC](https://community.traefik.io/t/404-when-using-pathprefix-or-path/13609/2 "2022-04-22T03:21:05Z")

</div>

Also very interested in this one, anyone come up with a solution? I can also only get it to work just a Host, buth Paths do not work. Much appreciated.
