title: Spring MVC web app behind zuul redirect issue
body: <p>I have a set of Spring Boot (1.3.3) with Spring Cloud (Brixton.RC2) microservices running behind Zuul and I have issues with my urls being rewritten in redirects.</p>
  
  <p>My main issue is that my web app is behind zuul and seems to be unaware of host during redirects even though I should have set all necessary properties.</p>
  
  <p>When I go to <a href="http://test.example.com/" rel="noreferrer">http://test.example.com/</a> I expect to be redirected to <a href="http://test.example.com/login" rel="noreferrer">http://test.example.com/login</a> but I get redirected to <a href="http://machinehostname/login" rel="noreferrer">http://machinehostname/login</a>... If I go directly to <a href="http://test.example.com/login" rel="noreferrer">http://test.example.com/login</a> I can see my login form and login but then get redirected to <a href="http://machinehostname/" rel="noreferrer">http://machinehostname/</a> but if i manually go to <a href="http://test.example.com/" rel="noreferrer">http://test.example.com/</a> I can use my application properly again with exeception of redirects, after a POST in a form for example.</p>
  
  <p>Here are some of the properties of my web app :</p>
  
  <pre><code>server.use-forward-headers = true
  server.tomcat.protocol-header = X-Forwarded-Proto
  server.tomcat.remote-ip-header = X-Forwarded-For
  </code></pre>
  
  <p>Here is my zuul properties :</p>
  
  <pre><code>#Server
  server.port = 80
  server.use-forward-headers = true 
  
  #Zuul
  zuul.add-proxy-headers = true
  zuul.ignored-services = "*"
  
  zuul.routes.api.service-id = api
  zuul.routes.api.path = /api/**
  zuul.routes.api.strip-prefix = true
  
  zuul.routes.web.service-id = web
  zuul.routes.web.path = /**
  </code></pre>
  
  <p>My security setup in the web app :</p>
  
  <pre><code>@Override
  protected void configure(HttpSecurity httpSecurity) throws Exception {
      //@formatter:off
      httpSecurity
          .formLogin()
              .successHandler(new SavedRequestAwareAuthenticationSuccessHandler())
              .loginPage("/login")    
                  .permitAll()
              .failureUrl("/login-error")
              .defaultSuccessUrl("/")
              .and()
          .logout()
              .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
                  .logoutSuccessUrl("/logged-out")
                      .permitAll()
              .and()
              .anyRequest()
                  .authenticated();
      //@formatter:on
  }
  </code></pre>
  
  <p>Again, all urls are properly using the server name <strong>unless it is a redirect</strong>. Any idea how to fix that ?</p>
  
  <p>Thanks a lot !</p>