I have a windows 10 home with Linux kali running inside it with vmware virtual machine software.
There is a local website that opens on url https://example.com in linux and has self signed certificate. I have added it's ip entry on etc/hosts
file so that it opens on example.com.
The /etc/hosts file entry on linux:
192.168.49.2 example.com
This local website redirects to https url when opened on browser i.e. http://example.com =>>> https://example.com.
The website is hosted on kubernetes with the ingress code given below:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: first-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
tls:
- hosts:
- example.com
secretName: myssl
rules:
- host: example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: first-service
port:
number: 8080
(I don't think ingress code is needed in the question but for the sake I gave it.)
The problem is that I cannot do ssh local port fowarding to it from my windows. The ssh script is:
ssh -L 9090:example.com:80 [email protected]
I get 404 Not Found nginx error.
I also tried with 443 port with the following command:
ssh -L 9090:example.com:443 [email protected]
In this case the error is:
400 Bad Request
The plain HTTP request was sent to HTTPS port
nginx
I also get error saying "The certificate chain was issued by an authority that is not trusted." when opening url - "https://localhost:9090/".
If I remove the redirection then the ssh local port redirection works fine and i am able to open the website on my windows browser with localhost:9090
url. This problem happens only when their is redirection.
How can I solve this problem?