Installing Metabase on multiple web servers for high availability

I am trying out the architecture where I have 2 web servers where I will have metabase instance running. One database server where I will install postgres as application database. Both the metabase instances will point to this db host. I will have a load balancer sitting on top of web servers which will distribute the traffic between 2 webservers.
I am able to do all of the above successfully however, it is not turning out to be what I was expecting. when I invoke public IP of load balancer, it distributes to one of the two web servers and shows me a login page. When I try to login with my id I get this error.

404 Not Found

Not Found

The requested URL /api/session was not found on this server.

Hi @jiwnaiakbar
I would guess that you’re doing some reverse-proxy on the web-servers besides also doing that on the load balancer.
First guess is that your web-server is intercepting the request and returning a different response.
Check your browser developer Network-tab to see the header to know where response is coming from.
Also see:

Hi @flamber

I am not doing any reverse proxy.
I am using port forwarding on the webservers.

sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000

For testing purpose i turned of one server so that traffic always goes to that server. I still get the same error. For testing I directly opened public ip of the webserver and everything works nicely. So only when traffic is routed via load balancer I see this issue.

A web load balancer is a reverse proxy.

I guess the problem must be in the configuration of the load balancer. It’s almost impossible to help, since you haven’t given any detailed information about your setup or configuration.

Check your logs to see where the requests are being sent to. One thing is for sure, the error does not come from Metabase.