To allow the [::]:5173 requests through the ingress to the webserver, you can modify the InertiaJS client requests to use a prefixed URL that can be routed to port 5173 on the webserver.
Here's how you can achieve this:
- Update the client-side code to use a prefixed URL. In your app.jsx file, change the
createInertiaAppfunction call to include theurloption with the desired prefix. For example:
import { createInertiaApp } from '@inertiajs/inertia-react';
createInertiaApp({
resolve: (name) => require(`./Pages/${name}`),
setup({ el, App, props }) {
// ...
},
url: (url) => {
// Add the prefix to the URL
return `/prefix${url}`;
},
});
- Configure your Kubernetes ingress to route requests with the prefix
/prefixto port 5173 on the webserver. You'll need to update your ingress configuration file to include a new rule for this. Here's an example:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: your-ingress
spec:
rules:
- http:
paths:
- path: /prefix
pathType: Prefix
backend:
service:
name: your-webserver-service
port:
number: 5173
Replace your-ingress with the name of your ingress resource, your-webserver-service with the name of your webserver service, and make sure to apply this configuration to your Kubernetes cluster.
With these changes, the InertiaJS client requests will be sent to the prefixed URL, which will be routed to port 5173 on the webserver through the Kubernetes ingress.