Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to another entryPoint gives "Too many redirects" error #2925

Closed
carlosedp opened this issue Feb 24, 2018 · 3 comments
Closed

Redirect to another entryPoint gives "Too many redirects" error #2925

carlosedp opened this issue Feb 24, 2018 · 3 comments
Assignees
Labels
area/middleware kind/bug/confirmed a confirmed bug (reproducible). priority/P1 need to be fixed in next release status/5-frozen-due-to-age
Milestone

Comments

@carlosedp
Copy link
Contributor

carlosedp commented Feb 24, 2018

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

Bug

What did you do?

I want to redirect a specific Ingress from http to https in a Kubernetes Cluster. Currently using v1.5.2 image.

My Ingress yaml is:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubernetes-dashboard-external
  namespace: kube-system
  annotations:
    traefik.frontend.rule.type: PathPrefix
    traefik.frontend.redirect.entryPoint: https
    ingress.kubernetes.io/auth-type: basic
    ingress.kubernetes.io/auth-secret: dashboard-auth
spec:
  rules:
  - host: dashboard.cloud.mydomain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: kubernetes-dashboard
          servicePort: 80

When I access the address, I get a "too many redirects" error.

$ wget http://dashboard.cloud.mydomain.com
--2018-02-24 16:10:44--  http://dashboard.cloud.mydomain.com/
Resolving dashboard.cloud.mydomain.com (dashboard.cloud.mydomain.com)... 190.219.173.145
Connecting to dashboard.cloud.mydomain.com (dashboard.cloud.mydomain.com)|190.219.173.145|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dashboard.cloud.mydomain.com:443/ [following]
--2018-02-24 16:10:44--  https://dashboard.cloud.mydomain.com/
Connecting to dashboard.cloud.mydomain.com (dashboard.cloud.mydomain.com)|190.219.173.145|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dashboard.cloud.mydomain.com:443/ [following]
....
20 redirections exceeded.

What did you expect to see?

Correct redirection from http to https

What did you see instead?

Too many redirects error.

As a workaround I replaced the annotation:

traefik.frontend.redirect.entryPoint: https

With:

    #traefik.frontend.redirect.regex: ^http://(.*)
    #traefik.frontend.redirect.replacement: https://$1

and have a functional deployment.

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

Version:      v1.5.2
Codename:     cancoillotte
Go version:   go1.9.4
Built:        2018-02-12_10:56:31AM
OS/Arch:      linux/arm64

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

defaultEntryPoints = ["http","https"]
debug = false
logLevel = "INFO"

[entryPoints]
  [entryPoints.http]
  address = ":80"
  compress = true
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]

[web]
  address = ":8080"

[metrics]
  [metrics.prometheus]
  buckets=[0.1,0.3,1.2,5.0]
  entryPoint = "traefik"

[acme]
email = "aaa.@aaa.com"
storage = "/etc/traefik/acme.json"
acmeLogging = true
entryPoint = "https"
onDemand = false
OnHostRule = true
caServer = "https://acme-v01.api.letsencrypt.org/directory"
[acme.httpChallenge]
entryPoint="http"
@ldez ldez self-assigned this Feb 24, 2018
@ldez ldez changed the title Redirect to another entryPoint on Kubernetes gives "Too many redirects" error Redirect to another entryPoint gives "Too many redirects" error Feb 24, 2018
@dtomcej
Copy link
Contributor

dtomcej commented Feb 25, 2018

Hello @carlosedp, Please disregard my previous comment.

We were able to reproduce this issue, and will be working on a fix.

In the meantime, please feel free to either use the regex redirect, or one of the following annotations for ssl-redirection:

ingress.kubernetes.io/ssl-redirect:true oringress.kubernetes.io/ssl-temporary-redirect:true

Thanks!

@carlosedp
Copy link
Contributor Author

Ok, the point is that I use both http and https entrypoints... so I can't redirect the traffic globally to https. The regex is working fine. Gonna wait for the fix.
Thanks!

@ldez ldez added kind/bug/confirmed a confirmed bug (reproducible). priority/P1 need to be fixed in next release and removed status/0-needs-triage labels Feb 25, 2018
@traefiker
Copy link
Contributor

Closed by #2929.

@traefiker traefiker added this to the 1.5 milestone Feb 26, 2018
@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/middleware kind/bug/confirmed a confirmed bug (reproducible). priority/P1 need to be fixed in next release status/5-frozen-due-to-age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants