Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing an IBM AppConnect using Custom path #6321

Open
1 task done
Rockyjr-git opened this issue Jul 16, 2024 · 9 comments
Open
1 task done

Routing an IBM AppConnect using Custom path #6321

Rockyjr-git opened this issue Jul 16, 2024 · 9 comments
Labels
bug Something isn't working pending author feedback

Comments

@Rockyjr-git
Copy link

Rockyjr-git commented Jul 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues

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

Expected Behavior

Expected to work on the Custom path (/Echo)

Steps To Reproduce

Anthos Bare metal Cluster on the Air Gapped Environment.

Kong Ingress Controller version

v3.1

Kubernetes version

v1.27

Anything else?

No response

@Rockyjr-git Rockyjr-git added the bug Something isn't working label Jul 16, 2024
@randmonkey
Copy link
Contributor

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.

@Rockyjr-git
Copy link
Author

@randmonkey Thanks for the suggestion.

IBM AppConnect web page is displaying blank screen after adding the annotation. Can you Please help me here.

Screenshot 2024-07-17 190243
Screenshot 2024-07-17 190159

@randmonkey
Copy link
Contributor

randmonkey commented Jul 18, 2024

@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/.

@Rockyjr-git
Copy link
Author

@randmonkey Rewriteuri is already enabled, IBM AppConnect is working on root path. I am trying to route to other than root path.
rewrite-uri

@randmonkey
Copy link
Contributor

@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

@Rockyjr-git
Copy link
Author

As suggested used the same Ingress yaml, but still the same blank web page.
Screenshot 2024-07-18 134518
Screenshot 2024-07-18 134645

@randmonkey
Copy link
Contributor

@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.

@Rockyjr-git
Copy link
Author

Thanks for quick response again, Am i missing anything here again.
Screenshot 2024-07-22 191336
Screenshot 2024-07-22 191315

@randmonkey
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending author feedback
Projects
None yet
Development

No branches or pull requests

2 participants