Spring MVC web application behind zuul redirect problem

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/** zuul.routes.api.strip-prefix = true zuul.routes.web.service-id = web zuul.routes.web.path = /** 

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!

+4
spring-boot spring-security netflix-zuul spring-cloud-netflix
source share

No one has answered this question yet.

See similar questions:

10
Spring URL redirection problem when behind Zuul proxy

or similar:

25
Spring Boot with integrated Tomcat behind Apache proxy
thirteen
Security Configuration Using Spring-boot
10
Spring URL redirection problem when behind Zuul proxy
3
Spring zuul proxy does not accept carrier token
2
spring-ws behind Zuul proxy
one
zuul + okta + springboot - OKTA redirect uri issue 404
one
Spring Oauth2 AWS Authentication for Zuul
0
Spring Security Thymleaf Static Resources Not Loading
-one
Spring Boot Web MVC Allow one user at a time from anywhere

All Articles