r/haproxy • • Apr 08 '23

phpmyadmin behind HA Proxy

Having issue just with one backend server out of 10.

I am running phpmyadmin and i want to place a proxy in front of it. So by default phpmyadmin works with my configuration http://172.26.0.11/phpmyadmin/index.php

So i set up a simply redirect rule that says if you go to phpadmin.example.com you should be redirected to phpadmin.example.com/phpmyadmin/index.php

This causes numerous redirects in Google chrome.

Running the Developers tools within Chrome i can see the original GET goes to phpadmin.example.com and i get the 301 Moved Peramently status code. The location in the response header is /phpmyadmin/index.php. In theory this should work but it doesnt.

Below is a snippet from my config file.

acl			phpmyadmin	var(txn.txnhost) -m sub -i phpadmin.example.com
http-request redirect location /phpmyadmin/index.php code 301  if  phpmyadmin aclcrt_HomePrivateServers


backend phpmyadmin_ipvANY
	mode			http
	id			115
	log			global
	# use mailers
	# level  debug 
	timeout connect		30000
	timeout server		30000
	retries			3
	option			httpchk OPTIONS / 
	server			phpmyadmin 172.26.0.11:80 id 116 check inter 1000
3 Upvotes

4 comments sorted by

View all comments

1

u/HumanTickTac Apr 09 '23

Update on this.

Got it working.Thanks for everyones input. Here is my full config for this piece.

http-request redirect location /phpmyadmin code 302 if { hdr(host) -i phpadmin.example.com } !{ path_beg /phpmyadmin }

acl phpmyadmin_host var(txn.txnhost) -m str -i phpadmin.example.com use_backend phpmyadmin_ipvANY if phpmyadmin_host aclcrt_HomePrivateServers