Skip to content

Always get 404 accessing my nginx backend service #1112

@xinxiaogang

Description

@xinxiaogang

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

Lastest docker image, it should be v1.1.2

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

I deploy traefik as the Ingress controller in my kubernetes cluster.
My toml:

    # traefik.toml
    defaultEntryPoints = ["http","https"]
    [entryPoints]
      [entryPoints.http]
      address = ":80"
        [entryPoints.http.redirect]
          entryPoint = "https"
      [entryPoints.https]
      address = ":443"
        [entryPoints.https.tls]
          [[entryPoints.https.tls.certificates]]
          CertFile = "/ssl/tls.crt"
          KeyFile = "/ssl/tls.key"
    [web]
    address = ":8080"
    ReadOnly = true

My arguments:

        args:
        - --configfile=/config/traefik.toml
        - --web
        - --kubernetes
        - --kubernetes.namespaces=ciaas-qa
        - --logLevel=DEBUG

What did you do?

I want to use traefik for my TLS termination at L7 level. My real service is provided by a nginx pod. I create Ingress spec as below:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: traefik
  name: ingress-my-nginx
spec:
  rules:
  - http:
      paths:
      - backend:
          serviceName: my-nginx
          servicePort: 80
        path: /my-nginx

But I get 404 when accessing https://ingress.ciaas-qa.svc.33.tess.io/my-nginx. ingress.ciaas-qa.svc.33.tess.io is my ingress service DNS record.

What did you expect to see?

I should see the nginx welcome page.

What did you see instead?

I got 404 page from my nginx:

<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.11.9</center>
</body>
</html>

More info:

Here is the traefik configuration I get from the API:

// 20170204203405
// http://ingress-console.ciaas-qa.svc.33.tess.io:8080/api/providers/kubernetes

{
  "backends": {
    "/my-nginx": {
      "servers": {
        "my-nginx-379829228-9eylj": {
          "url": "http://10.148.168.235:80",
          "weight": 0
        }
      },
      "loadBalancer": {
        "method": "wrr"
      }
    }
  },
  "frontends": {
    "/my-nginx": {
      "entryPoints": [
        "http",
        "https"
      ],
      "backend": "/my-nginx",
      "routes": {
        "/my-nginx": {
          "rule": "PathPrefix:/my-nginx"
        }
      },
      "passHostHeader": true,
      "priority": 9
    }
  }
}

my-nginx-379829228-9eylj is my nginx pod name, 10.148.168.235 is the nginx pod IP. And I can get expected welcome page if I use http://10.148.168.235:80 directly in the browser. But use https://ingress.ciaas-qa.svc.33.tess.io/my-nginx get 404.

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