I have a Spring Boot suite (1.3.3) with Spring Cloud microservices (Brixton.RC2) working for Zuul, and I have problems rewriting my URLs in redirects.
My main problem is that my web application is behind zuul and does not seem to know about the host during the redirect, although I had to set all the necessary properties.
When I go to http://test.example.com/ I expect to be redirected to http://test.example.com/login , but I will be redirected to http: // machinehostname / login ... If I go directly to http://test.example.com/login I can see my registration form and login, but then redirect to http: // machinehostname / , but if I manually go to http://test.example.com/ I can use your application again with canceling redirection after POST in the form, for example.
Here are some of the properties of my web application:
server.use-forward-headers = true server.tomcat.protocol-header = X-Forwarded-Proto server.tomcat.remote-ip-header = X-Forwarded-For
Here are my zuul properties:
#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
My web application security setting:
@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 }
Again, all URLs correctly use the server name if it is not a redirect . Any idea how to fix this?
Thank you so much!
spring-boot spring-security netflix-zuul spring-cloud-netflix
Damien polegato
source share