Is there any way with Ingress to control the service and port destination depending on whether the request is http or https?
I'm trying to do something similar to this:
http://localhost/my_path -> http://service:9955/my_path
https://localhost/my_path -> https://service:9443/my_path
For example, I've been using this configuration in nginx.conf and works as expected:
server {
server_name localhost;
listen 80;
location /my_path {
proxy_pass http://service:9955/my_path;
}
}
server {
server_name localhost;
listen 443 ssl;
location /my_path {
proxy_pass https://service:9443/my_path;
}
}
I tried to reproduce this configuration in Ingress.yaml but I can't find a way to define which rule belongs to http and which one to https.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-rules
annotations:
spec:
ingressClassName: nginx
rules:
- host: localhost
http:
paths:
- path: /my_path
pathType: Exact
backend:
service:
name: service
port:
number: 9955
- path: /my_path
pathType: Exact
backend:
service:
name: service
port:
number: 9443
Thank you for your time.