HAProxy community

Redirect All HTTPS Webpage To One Page

Hi Dear Friends I have Ip address Range that If user Browser Want Browse any https website For example https://google.com and https://yahoo.com redirect to https://example.com

Please help me

Do you want to implement some kind of captive portal? (I.e. any request should be redirected on an internal page?)

You can easily achieve this by using http-request redirect location https://example.com/ if { src 10.9.8.0/24 } in a frontend.

However please note that this wouldn’t actually work in practice because you couldn’t have the TLS certificate for the sites you are trying to impersonate! (This is one of the main purposes of HTTPS, namely breaking any attempt to impersonate them.)


That being said you could use the generate-certificates option (and related), however you’ll have to inject your own CA certificate in your users browsers and applications, which is an extremely bad idea and practically infeasible.

Moreover “high-value” sites like Google and similar are protected even against this type of impersonation by using HTTP Public Kep Pinning, therefore rendering these redirects useless.


Could you perhaps be more explicit in what you are trying to achieve? Perhaps there is an alternative solution.

No problem But I want Redirect for example https://domin1.com to https:domain2.com

No problem that Browser have error missmath