# Prometheus metrics routing issue

**URL:** <https://community.traefik.io/t/prometheus-metrics-routing-issue/7111>\
**Category:** Traefik v2\
**Tags:** metrics, docker\
**Created:** [July 28, 2020, 8:13am UTC](https://community.traefik.io/t/prometheus-metrics-routing-issue/7111 "2020-07-28T08:13:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xoxys](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/xoxys/32/2498_2.png) [@xoxys](https://community.traefik.io/u/xoxys)\
**Post date:** [July 28, 2020, 8:13am UTC](https://community.traefik.io/t/prometheus-metrics-routing-issue/7111/1 "2020-07-28T08:13:33Z")

</div>

Hi,

what I try to do is to expose the prometheus metrics on a custom endpoint protected by a basic auth middleware. So the result should look like this: [https://myhost.example.com/my\_metrics](https://myhost.example.com/my_metrics).

What I've done so far:

```auto
metrics:
  prometheus:
    buckets: [0.1, 0.3, 1.2, 5.0]
    manualRouting: true

```

At this point, metrics should be enabled in general but I should not be able to access the endpoint on any route, right? I will need to define a dedicated router first because I've set `manualRouting: true`. At least, that was my understanding, but here comes the first question: At this point I'm already able to access the metrics at http:///metrics. Why is this possible?

To get [https://myhost.example.com/my\_metrics](https://myhost.example.com/my_metrics) working I've added the following labels to my traefik container:

```auto
--label traefik.enable=true \
  --label traefik.docker.network=traefik \
  --label traefik.http.routers.metrics.rule="Host(`myhost.example.com`) && Path(`/my_metrics`)" \
  --label traefik.http.routers.metrics.service=prometheus@internal \
  --label traefik.http.routers.metrics.entrypoints=https \
  --label traefik.http.routers.metrics.tls=true \
  --label traefik.http.routers.metrics.middlewares=auth@file,https@file,secure@file \
  --label traefik.http.routers.metrics-insecure.rule="Host(`myhost.example.com`) && Path(`/my_metrics`)" \
  --label traefik.http.routers.metrics-insecure.service=prometheus@internal \
  --label traefik.http.routers.metrics-insecure.entrypoints=http \
  --label traefik.http.routers.metrics-insecure.middlewares=auth@file,https@file,secure@file

```

Perfect, at this point [https://myhost.example.com/my\_metrics](https://myhost.example.com/my_metrics) works and this endpoint is basic auth protected. But http:///metrics is still working even without auth...
