Reputation: 597
I'm deploying this list.
And Ingress NodePort is 80:31361, 443:30482
in kubectl get svc -n ingress-nginx
The problem is in Ingress
.
To load PhpMyAdmin
page, I typed url as http://my-ip:31361/pma
.
But every resources are not found with 404 error.
If I typed url as http://my-ip:31361/pma/
, It works finely.
Only difference is /
.
Why this is happen?
How can I page pma
or main
without /
?
Upvotes: 0
Views: 935
Reputation: 597
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/configuration-snippet: |
rewrite ^\/(main|pma)$ $1/ permanent;
spec:
rules:
- http:
paths:
- path: /main(/|$)(.*)
pathType: Prefix
backend:
service:
name: frontend-service
port:
number: 80
- path: /pma(/|$)(.*)
pathType: Prefix
backend:
service:
name: pma-service
port:
number: 80
As a result, I didn't remove /
.
However, If user load page as /main
, nginx will redirect to /main/
, /pma
-> /pma/
.
Then every resouces are accessible.
Thank you @P....
Upvotes: 1