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
    December 10, 2024 06:22

    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
    December 10, 2024 06:09

    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
    August 19, 2024 07:46

    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
    August 29, 2023 14:21

    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
    August 16, 2023 17:04

    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
    July 26, 2022 13:39

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