WordPress redirect loop

Had the problem after upgrade recently. Turned out it was because Cloudfront SSL termination causes wordpress to keep redirecting https.

Solution here.