Rewrite the hostname part of the 302 Location header response

When the "Host rewrite" feature is enabled on the HTTP Loadbalancer and the backend server responds with 302 redirects with absolute path Location header (which includes the hostname the was rewritten by the HTTP LB), we need a way to rewrite the hostname part of the path in the Location header back to what the client initially requested, otherwise the client will try to redirect to an internal hostname, breaking the connection.

  • Valentin Tobi
  • Apr 2 2022
  • Attach files
  • Zasleen Kapatralla commented
    10 Dec, 2024 06:22am

    To expand on my previous comment, this idea is similar to what we achieve through an iRule in BIG-IP:

    https://my.f5.com/manage/s/article/K02027845

  • Zasleen Kapatralla commented
    10 Dec, 2024 06:09am

    I too have the same requirement from one of my customer where they want the path rewrite and not the host rewrite. this isn't possible via redirect route as its completely redirecting the the host along with path to the newer path but not rewriting it.

  • Guest commented
    19 Aug, 2024 07:46am

    is anything happening with this feature? it's fundamental feature which every modern reverse proxy solution should support. I like volterra/F5 but here we are behind the competitive products. This location head manipulation is also supported (not only azure application gateway) but also on apache https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

  • Nikolay Dimitrov commented
    29 Aug, 2023 02:21pm

    Have you tried playing with the XC Route option as you can send Redirects to it based on the URL/header match?



  • Arjun Ayapparaj commented
    16 Aug, 2023 05:04pm

    I think there should be a way to rewrite any request/response headers as shown here.


    https://azure.microsoft.com/en-us/blog/rewrite-http-headers-with-azure-application-gateway/

  • Ralf Bruenig commented
    26 Jul, 2022 01:39pm

    If we use DNS discovery for the origin server, we could by default rewrite redirects from the discovery domain towards the Global LB domain.