Skip to content

Rest provider PUT giving 404 when API auth is enabled #5785

@blakegearin

Description

@blakegearin

Do you want to request a feature or report a bug?

Bug

What did you do?

I set up a very simple docker-compose.yml based on Traefik documentation where API has basicAuth

When I include --providers.rest.insecure=true I'm able to PUT a file to localhost:8080/api/providers/rest (with or without user credentials).

When I remove --providers.rest.insecure=true I'm not able to PUT a file anymore

What did you expect to see?

I expect that when I include the correct credentials the PUT will succeed and return something like {"http:{...}}

What did you see instead?

  • When I include the correct credentials I get 404 page not found
  • When I include incorrect credentials I get 401 Unauthorize

Output of traefik version: (What version of Traefik are you using?)

traefik:v2.0 (image)

What is your environment & configuration (arguments, toml, provider, platform, ...)?

OS: macOS Mojave
Docker Compose: v1.24.1, build 4667896b

version: '3'

services:
  reverse-proxy:
    # The official v2.0 Traefik docker image
    image: traefik:v2.0
    # Enables the web UI and tells Traefik to listen to docker
    command:
      - "--api=true"
      - "--api.debug=true"
      # - "--api.insecure=true"
      - "--providers.rest=true"
      # - "--providers.rest.insecure=true"
      - "--ping=true"
      - "--providers.docker"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web-secure.address=:443"
      - "--entryPoints.traefik.address=:8080"
      - "--accesslog.filters.retryattempts=true"
      - "--accesslog=true"
      - "--log.level=DEBUG"
    ports:
      # The HTTP port
      - "80:80"
      # The Web UI (enabled by --api.insecure=true)
      - "8080:8080"
    volumes:
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - "traefik.http.routers.api.rule=Host(`localhost`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.middlewares=myAuth"
      - "traefik.http.middlewares.myAuth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/,test2:$$apr1$$d9hr9HBB$$4HxwgUir3HP4EsggP/QNo0"

(I left the insecure lines commented so it's easy to toggle)

If applicable, please paste the log output in DEBUG level (--log.level=DEBUG switch)

When I include the correct credentials:

reverse-proxy_1  | time="2019-11-05T22:06:09Z" level=debug msg="Authentication succeeded" middlewareType=BasicAuth middlewareName=myAuth@docker

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions