Though this has been answered by Mariano, I wanted to add that it works for Spring Boot. However, if you don't use Spring Boot and instead use Spring 5.1.X in a traditional web application deployed within J2EE container (like mine), you will need to add a filter to your web application's web.xml similar to below:
<filter>
<filter-name>forwardedHeaderFilter</filter-name>
<filter-class>org.springframework.web.filter.ForwardedHeaderFilter</filter-class>
<init-param>
<param-name>relativeRedirects</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>forwardedHeaderFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Besides this, you will also need to upgrade Hateoas to version 0.25.1 where this issue has been fixed from Hateoas side.