Please make sure adding ` ingress.kubernetes.io/rewrite-target: /`
annotation to your service profile, otherwise, nginx proxy will not work.
```
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: mynginx
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: test.jizhihuwai.com
http:
paths:
- path: /v1
backend:
serviceName: my-nginx
servicePort: 80
- path: /v2
backend:
serviceName: my-nginx-1
servicePort: 80
```
There is also some configuration here:
https://github.com/kubernetes/ingress/blob/master/controllers/nginx/configuration.md#rewrite
On Thu, Mar 9, 2017 at 9:42 AM, <[email protected]> wrote:
> I am trying to use an Ingress with path-based routing, similar to the
> following example:
>
> apiVersion: extensions/v1beta1
> kind: Ingress
> metadata:
> name: path-based-ingress
> spec:
> rules:
> - http:
> paths:
> - path: /foo
> backend:
> serviceName: http-svc
> servicePort: 80
>
> But when I make a request to the host ip address with a path (i.e. curl -i
> http://1.2.3.4/foo), I get a "404 - Not Found" response. If I change the
> path in the ingress config file to just "/" and run "curl -i
> http://1.2.3.4/", everything works fine; I get a valid response.
>
> Thanks in advance for any help!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Kubernetes user discussion and Q&A" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.