I've set up a cluster which is using Kubernetes Ingress as its Ingress controller . On a seperate server, I set up a HAProxy to route requests received on its port 80 to the cluster.
When trying to load a Spring Boot/ReactJS app, I am getting net::ERR_ABORTED 503 (Service Unavailable)
errors when it tries to download its static files and other assets.
haproxy.cfg:
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http_front
bind *:80
stats uri /haproxy?stats
#Define hosts (dev/prod)
acl dev_host path_reg ^/dev/..*$
acl prod_host path_reg ^/prod/..*$
#select backend to use
use_backend dev_backend if dev_host
use_backend prod_backend if prod_host
backend dev_backend
balance roundrobin
server worker1 10.62.194.5:31970
backend prod_backend
balance roundrobin
server worker1 10.62.194.8:31019
#backend http_back
# balance roundrobin
# server worker 10.62.194.5:80
Ingress Resource:
Name: app-ingress
Namespace: app
Address:
Default backend: default-http-backend:80 (<none>)
Rules:
Host Path Backends
---- ---- --------
*
/dev/app gdf:80 (10.244.1.129:8080)
/* gdf:80 (10.244.1.129:8080)
Annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/ssl-redirect: false
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 40m nginx-ingress-controller Ingress dmi/app-ingress
The issue is because it tries to fetch the resources from the root which sends the request back to the proxy. Since the proxy has to rule to match /___ it fails.
Any workarounds? Either on the side of JS or HAProxy/Kubernetes