How to route http requests to a https service

I have a https Service and https/websecure IngressRoute like that.

apiVersion: v1
kind: Service
  name: my-https-service
    app: my-https-pod
  type: ClusterIP
    - port: 443
      targetPort: https
      protocol: TCP
      name: https
    app: my-https-pod
kind: IngressRoute
  name: my-route
    - websecure
  - match: PathPrefix(`/path`)
    kind: Rule
    - name: my-https-service
      port: 443
  tls: {}

This is working fine.

  • When I switch the entrypoint from https/websecure to http/web and remove the tls: {} part.
  • Then my request fail :frowning:

How can I route http requests to a https service in a Kubernetes cluster?

Thanks for any hint.

Hello @jwausle

Just to clarify, are you looking for the option to have redirection from HTTP to HTTPS?

@jakubhajek right. (hint: it's for development@localhost only)

I would recommend starting with RedirectScheme middleware, here is an example of how to use it.

You can also follow the further exercises in that repo to see how the redirection should be managed by creating two separate routers: the first one for HTTP (where you can assign the redirect scheme middleware) and HTTPS.

Here is also the recording of the workshop we have managed based on the example I've just shared.

I hope that helps.

Thanks @jakubhajek for Your answer.

Redirection is no option in my case.

Background: My problem is that the development setup of my cluster@localhost strict require http as entry point (~web)(functional reasons). There MUST never be a TLS handshake. Afaik lead redirection always to a TLS handshake.

I'm looking for an alternative way,

My current workaround: my-https-pod expose also a http port, which I can use for routing.

Hi I have a question…can someone install this to your iPhone without knowing and if so can it be deleted please sum1 get back to me…thanks