Kong and React Integration on kubernetes

Hi, We have set up a react application and deployed to kubernetes. When the application is exposed on Nodeport, the application is working fine as expected.

However, when we integrate with Kong API with a route default/portal , it is failing.

Our gateway url is https://apigw.test.com/default/portal redirected to port 3000 of react application. The landing page is looking for static files from https://apigw.test.com/static/bundle.js instead of https://apigw.test.com/default/portal/static/bundle.js. I am relatively new to this topic and any support would be appreciated.

1 Like

You’ll need to somehow inform your application of the path prefix it needs to append when rendering URLs. I’m not familiar with React, but it looks like something along the lines of the suggestion in reactjs - How to bundle a React app to a subdirectory on a server? - Stack Overflow should work.

If that’s not something you can control in your application you’d need to use a route/Ingress that uses a hostname and the root path (/) rather than a subdirectory.