Spring MVC “redirect:/” prefix redirects with port number included Spring MVC “redirect:/” prefix redirects with port number included nginx nginx

Spring MVC “redirect:/” prefix redirects with port number included


use $server_port instead of $proxy_port part in you configuration.

change this line

proxy_set_header Host $host:$proxy_port;

to

proxy_set_header Host $host:$server_port;

Catalina's HttpServletResponse.sendRedirect implementation uses the getServerPort method to build an absolute redirect url (Location Header-Value). getServerPort returns the part after the : from the request's HostHeader-Value which has to be 8085 in your case.