# Simple PathPrefix rule results in "Gateway Timeout"

**URL:** <https://community.traefik.io/t/simple-pathprefix-rule-results-in-gateway-timeout/2968>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [November 15, 2019, 4:21pm UTC](https://community.traefik.io/t/simple-pathprefix-rule-results-in-gateway-timeout/2968 "2019-11-15T16:21:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkrenn](https://avatars.discourse-cdn.com/v4/letter/d/7993a0/32.png) [@dkrenn](https://community.traefik.io/u/dkrenn)\
**Post date:** [November 15, 2019, 4:21pm UTC](https://community.traefik.io/t/simple-pathprefix-rule-results-in-gateway-timeout/2968/1 "2019-11-15T16:21:03Z")

</div>

I've set up a simple router with rule `PathPrefix(`/me`)` but requests are not routed and instead I get

```nohighlight
Gateway Timeout

```

(E.g. by calling `http://my-server-name.com/me/`)  
Does anyone have an idea why it is not working? Any suggestions are welcome 🙂

What is working is `http://my-server-name.com:8000/me/` so the service (`nginx` server) is up and running correctly; only the routing is not working.

A minimal (non-)working example is: `docker-compose.yml`:

```auto
version: '3'

services:
  traefik:
    image: traefik:v2.0.5
    ports:
    - 80:80
    - 443:443
    - 8080:8080 # traefik GUI
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - ./traefik.yml:/etc/traefik/traefik.yml
    restart: always
    networks:
      - webgateway
      
  nginx:
    image: nginx
    ports:
      - 8000:80
    volumes:
      - /home/user/html/:/usr/share/nginx/html:ro
    restart: always
    labels:
      # traefik basic
      - "traefik.enable=true"
      - "traefik.docker.network=webgateway"
      # traefik actual router
      - "traefik.http.routers.testr.entrypoints=web"
      - "traefik.http.routers.testr.rule=PathPrefix(`/me`)"
      # traefik service
      - "traefik.http.services.tests.loadbalancer.server.port=80"

networks:
  webgateway:
    driver: bridge

```

`traefik.yml`:

```auto
entryPoints:
  web:
    address: ':80'
  web-secure:
    address: ':443'
  traefik:
    address: ':8080'

providers:
  docker:
    watch: true
    exposedByDefault: false

api:
  insecure: true
  dashboard: true
  debug: true

log:
  level: DEBUG

```

(I've also tried playing with port like `traefik.http.services.tests.loadbalancer.server.port=8000` etc, but it was pointed out to me in "[Non-existent resolver: using docker + letsencrypt in static config](https://community.containo.us/t/non-existent-resolver-using-docker-letsencrypt-in-static-config/2962/9)" that it should be `80`)

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [November 15, 2019, 4:46pm UTC](https://community.traefik.io/t/simple-pathprefix-rule-results-in-gateway-timeout/2968/2 "2019-11-15T16:46:58Z")

</div>

Seems to work without the network.

```auto
version: '3'

services:
  traefik:
    image: traefik:v2.0.5
    restart: always
    ports:
    - 80:80
    - 443:443
    - 8080:8080 # traefik GUI
    # networks:
    # - webgateway
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command:
      - --entrypoints.web.address=:80
      - --entrypoints.web-secure.address=:443
      - --providers.docker
      - --providers.docker.exposedbydefault=false
      - --api.insecure
      - --log.level=DEBUG

  nginx:
    image: nginx
    # restart: always
    # volumes:
      # - /home/user/html/:/usr/share/nginx/html:ro
    labels:
      # traefik basic
      traefik.enable: true
      # traefik.docker.network: webgateway

      # traefik actual router
      traefik.http.routers.testr.entrypoints: web
      traefik.http.routers.testr.rule: PathPrefix(`/me`)

      # traefik service
      traefik.http.services.tests.loadbalancer.server.port: 80

# networks:
# webgateway:
# driver: bridge

```

```auto
$curl localhost/me

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.17.4</center>
</body>

```

---

<div class="post-metadata">

**Author:** ![dkrenn](https://avatars.discourse-cdn.com/v4/letter/d/7993a0/32.png) [@dkrenn](https://community.traefik.io/u/dkrenn)\
**Post date:** [November 15, 2019, 5:04pm UTC](https://community.traefik.io/t/simple-pathprefix-rule-results-in-gateway-timeout/2968/3 "2019-11-15T17:04:48Z")

</div>

> [@ldez](#):
>
> Seems to work without the network.

Thanks, indeed. And indeed adding

```auto
    networks:
      - webgateway

```

to **every** container solved this issue.

See also ["Gateway Timeout" with docker · Issue #1254 · traefik/traefik · GitHub](https://github.com/containous/traefik/issues/1254)
