When our application server user proxy, that doesn’t set “X-Forwarded” headers with original request port, then we can use some hack in our application. Just ignore port when it is equal 80 or 443, cause it is default. For example instead of
"http://localhost:80/app", we will get
"https://localhost:443/app" will output
Inspired by Mat Banik strackoverflow answer – http://stackoverflow.com/a/5212336/5770135.