I have an haproxy that I want to reroute only one url from test.ai to www.test.ai
redirect prefix https://www.test.ai code 301 if { hdr(host) -i test.ai}
But for some reason I get the test.ai redirected you too many times.
You appear to have a redirect set somewhere else. If you're using Wordpress as a backend. You need to set your site URL and home.
define( 'WP_HOME' , 'https://test.ai'); define( 'WP_SITEURL', WP_HOME . '/'); Then you'll need to add:
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) $_SERVER['HTTPS']='on'; Finally be sure this is at the bottom...
require_once(ABSPATH . 'wp-settings.php'); Otherwise, you may have a redirect or rewrite in your apache/nginx setup