After digging in the source code, I found out that all link creations originates from this point and it seems to be impossible to configure forced use of https scheme in a 'standard' way.
So I created a filter that replaces http://
to https://
in request URL and the problem has gone. Here is the snippet:
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletRequestWrapper wrapped = new HttpServletRequestWrapper(request) {
@Override
public StringBuffer getRequestURL() {
final StringBuffer originalUrl = ((HttpServletRequest) getRequest()).getRequestURL();
final String updatedUrl = originalUrl.toString().replace("http://", "https://");
return new StringBuffer(updatedUrl);
}
};
filterChain.doFilter(wrapped, servletResponse);
}