I have an nodejs application running on kubernetes and the url is https://example.com
. The same application also serves '/api'. My requirement is when I hit https://example.com
, in the background it should hit https://example.com/api
but in frontend, it should show https://example.com
only.
I have already tried with below configuration of nginx ingress using nginx.ingress.kubernetes.io/rewrite-target: /api
but it doesnt work.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /api
name: test
namespace: test
spec:
rules:
- host: example.com
http:
paths:
- backend:
serviceName: test
servicePort: 8080