Make sure that the proxy is setting the X-Forwarded-Proto header to https appropriately, which should fix https detection.
https