Hi there, when I followed the example of api gateway example
I’m confused about ./api-gw/ingress-hashicups-frontend.yaml setting
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: route-hashicups
namespace: default
spec:
parentRefs:
- name: api-gateway
namespace: consul
rules:
- matches:
- path:
type: Exact
value: /hashicups
backendRefs:
- kind: Service
name: frontend
namespace: default
port: 3000
filters:
- type: URLRewrite
urlRewrite:
path:
replacePrefixMatch: /
type: ReplacePrefixMatch
seems like urlRewrite rule will re-route request from /hashicups to /
My expectation is that after re-route the request to /, the request will send directly to the backend service which will handle the request at path “/”, but in reality that request will go through API gateway again before sending to the backend service.
I’m not sure if this is by design or a potential bug. It borthered me so much because now I have to explicitly write my backend service handler to handle path like “service-name/endpoint” instead of just “/endpoint”, or add an extra layer of nginx before my backend service to handle that stuff.
Im super appreciate if anyone could give me any hints about this situation.