Open Rockyjr-git opened 1 month ago
Do you want the requests to /Echo/*
to be forwarded to /foo/*
? You can use the konghq.com/rewrite
annotation: https://docs.konghq.com/kubernetes-ingress-controller/latest/guides/requests/rewrite-annotation/. The feature needs you to set RewriteURIs
feature gate to true
. KIC 3.1 supports the feature.
@randmonkey Thanks for the suggestion.
IBM AppConnect web page is displaying blank screen after adding the annotation. Can you Please help me here.
@Rockyjr-git Looks like the URI in the request was not rewritten correctly. Did you enable the RewirteURIs
feature gate? If the feature gate is not enabled, the rewrite does not take effect.
Please look at this doc to configure feature gates in KIC: https://docs.konghq.com/kubernetes-ingress-controller/3.1.x/reference/feature-gates/.
@randmonkey Rewriteuri is already enabled, IBM AppConnect is working on root path. I am trying to route to other than root path.
@Rockyjr-git Similar to the example in the doc https://docs.konghq.com/kubernetes-ingress-controller/3.1.x/guides/requests/rewrite-annotation/ , you can define your Ingress
like this to keep your path after the matched prefix:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ace-ingress-rewrite
namespace: appconnect
annotations:
konghq.com/rewrite: "/$1"
konghq.com/strip-path: "true"
spec:
ingressClassName: kong
rules:
- http:
paths:
- path: /~/echo/(\w+)
pathType: ImplementationSpecific
backend:
service:
name: ace-service-7600
port:
number: 7600
As suggested used the same Ingress yaml, but still the same blank web page.
@Rockyjr-git You need to change pathType
to ImplementationSpecific
to make it work.
The pathType
should be ImplementationSpecific
to tell that the path
should be interpreted as a regular expression when it has the /~
prefix. Kong will match path of your requests with the regex (the parts of path
after the /~
prefix, in this case /echo/(\w+)
) and fill the part matched to the capture group (in this case the (\w+)
which means matching any number of letters, digits and underscores _
) into the $1
place.
Thanks for quick response again, Am i missing anything here again.
@Rockyjr-git Your configuration is right. Kong gateway itself is a REVERSE PROXY so configuration of rewrite URI does not affect your request from the browser to Kong gateway. So the URL displayed in your browser is not re-written. You can check the logs of your backend service to check the URI is successfully re-written if the logs are available.
Is there an existing issue for this?
Current Behavior
I have deployed IBM AppConnect in the Anthos Bare Metal Cluster and Kong Ingress Controller is deployed using Helm chart. I want to route the AppConnect using custom path (/foo) instead of root path (/). Curl -i http:///Echo is working, but blank is displayed with prefix /Echo. whereas it is working for root path.
Please suggest the steps or any documents for the custom path routing.
Tried using rewrite transformer, but it did not work.
![Screenshot 2024-07-16 180708](https://github.com/user-attachments/assets/2ca22eb1-9487-46b7-86e8-6bedc0e2b322)
Expected Behavior
Expected to work on the Custom path (/Echo)
Steps To Reproduce
Kong Ingress Controller version
Kubernetes version
v1.27
Anything else?
No response