title: Azure Application Gateway Redirection from empty hostname
body: <p>I have created an Application Gateway that needs to fulfill the working of my previous Resource (F5).</p>
  
  <pre><code>As a listener I use a hostname: hostname.stackoverflow.com that listens on 443
  
  As a Http Setting I am using a specific port being 4443 
  
  As a BackEnd pool I use the URL/FQDN of my dev VM.
  </code></pre>
  
  <p>This totally works If i create a VM in the VNET and add "hostname.stackoverflow.com" to the hosts file with the ip of the application gateway.</p>
  
  <p>Now I want to get a little further and add paths to my Application Gateway. 
  The goal is that if I use "hostname.stackoverflow.com" I need to redirect this to "Hostname.stackoverflow.com/login.aspx?guestlogin".</p>
  
  <p>As far I have tried the following.</p>
  
  <ul>
  <li>Add the "/login.aspx?guestLogin" to the HTTPS settings like this.
  <a href="https://i.stack.imgur.com/eYXkA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eYXkA.png" alt="enter image description here"></a></li>
  </ul>
  
  <p>When I try this inside my VM. The URL changes but the path that I added there was not added in the right way, This is what I got: 
  <a href="https://i.stack.imgur.com/LMU0x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LMU0x.png" alt="enter image description here"></a></p>
  
  <p>So That made me think override backend path is maybe not the right way to do this.
  Wanted To create a Redirection Rule That will redirect my "hostname.stackoverflow.com" to the "hostname.stackoverflow.com/login.aspx?guestLogin" But in the settings of the Application Gateway I need to provide a source path (meaning: I can not redirect from an empty hostname to a new url I think)</p>
  
  <p>I am very new to Azure and even more new to the Application Gateway. Is there something that I did wrong. Is there a better way to do this ?</p>
  
  <p>The iRule that I need to get in Application Gateway is as followed.</p>
  
  <pre><code>  if { [string tolower [HTTP::host]] equals "hostname.stackoverflow.com" } {
  
          if {[HTTP::path] eq "/"} {
                   HTTP::redirect "login.aspx?guestLogin"
      }
      elseif {[string tolower [HTTP::uri]] starts_with "/login.aspx?id="} {
                   set tail [string range [HTTP::uri] 12 end]
                   HTTP::redirect "login.aspx?guestLogin&amp;$tail"
      }
    pool default.pool
    }
  </code></pre>