I found a solution without using Nginx.
On top of the above mentioned changes, I just had to add the following to server.xml:
<Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="x-forwarded-for" protocolHeader="x-forwarded-proto" protocolHeaderHttpsValue="https" />
Using the X-Forwarded-Proto header of the HTTP request, changes the web server’s rewrite rule to apply only if the client protocol is HTTP and ignore the rewrite rule for all other protocols used by the client. This solved my issue and hopefully will help others.
Further on, the question is if would be possible to have this written somewhere in the cuba-platform files and have this line generated into server.xml during deployment. I’m new to cuba-platform, so I’m not sure if my question make sense.