HaProxy: Redirecting and Rewriting https requests for symfony application and multitenant urls and path

I’m using HaProxy 1.8r2 as a load balancer and reverse proxy for my SaaS application written in php and TWIG (Symfony).

In the SaaS application, we use the path /tenant/home for the tenant landing page.
“Normal users” use the default domain with the /tenant/home (/en/tenant/home) path to enter their page.

Some users come with their own URL and want direct redirection to their landing page.
At the moment, I use the redirect string:
redirect location /tenant/home if { path -i -m end / } { hdr(host) -i tenant-url.com }
so the landing page and entry point of the customer URL will be directly redirected to the internal landing page. This is created by ansible.

I tried to rewrite the URL with Http-request but it doesn’t work with the PHP Symfony backend. Is there a solution to this with the new recommended way.

Now I have the issue, that the application supports different languages expressed in the path /en/tenant/home.

With the current string, we redirect everything to the default language (German).

Is there an option to include the path segment (/en/) in the redirect URL without creating new redirects for all languages.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *